mirror of
https://github.com/llvm/llvm-project.git
synced 2025-05-14 11:26:09 +00:00
hoist the check for alloca size up so that it controls CanConvertToScalar
as well as isSafeAllocaToScalarRepl. llvm-svn: 65755
This commit is contained in:
parent
53f12b11dc
commit
e2bb5e31c8
@ -254,10 +254,12 @@ bool SROA::performScalarRepl(Function &F) {
|
|||||||
// value cannot be decomposed at all.
|
// value cannot be decomposed at all.
|
||||||
uint64_t AllocaSize = TD->getTypePaddedSize(AI->getAllocatedType());
|
uint64_t AllocaSize = TD->getTypePaddedSize(AI->getAllocatedType());
|
||||||
|
|
||||||
|
// Do not promote any struct whose size is too big.
|
||||||
|
if (AllocaSize < SRThreshold)
|
||||||
|
continue;
|
||||||
|
|
||||||
if ((isa<StructType>(AI->getAllocatedType()) ||
|
if ((isa<StructType>(AI->getAllocatedType()) ||
|
||||||
isa<ArrayType>(AI->getAllocatedType())) &&
|
isa<ArrayType>(AI->getAllocatedType())) &&
|
||||||
// Do not promote any struct whose size is too big.
|
|
||||||
AllocaSize < SRThreshold &&
|
|
||||||
// Do not promote any struct into more than "32" separate vars.
|
// Do not promote any struct into more than "32" separate vars.
|
||||||
getNumSAElements(AI->getAllocatedType()) < SRThreshold/4) {
|
getNumSAElements(AI->getAllocatedType()) < SRThreshold/4) {
|
||||||
// Check that all of the users of the allocation are capable of being
|
// Check that all of the users of the allocation are capable of being
|
||||||
|
Loading…
x
Reference in New Issue
Block a user