aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-03-01 02:26:47 +0000
committerChris Lattner <sabre@nondot.org>2009-03-01 02:26:47 +0000
commitaf89a3f1d3bc77f5f0c39ef8189b4506462b0111 (patch)
treef84804ed3197dccf51507544ba2676155b2d01ec
parent870b80722f7ce3232dd45e95cff663d177e0acc0 (diff)
hoist the check for alloca size up so that it controls CanConvertToScalar
as well as isSafeAllocaToScalarRepl. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@65755 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Transforms/Scalar/ScalarReplAggregates.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/Transforms/Scalar/ScalarReplAggregates.cpp b/lib/Transforms/Scalar/ScalarReplAggregates.cpp
index 3a4201bf81..92ac76be74 100644
--- a/lib/Transforms/Scalar/ScalarReplAggregates.cpp
+++ b/lib/Transforms/Scalar/ScalarReplAggregates.cpp
@@ -253,11 +253,13 @@ bool SROA::performScalarRepl(Function &F) {
// (allocations OF arrays are ok though), and an allocation of a scalar
// value cannot be decomposed at all.
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()) ||
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.
getNumSAElements(AI->getAllocatedType()) < SRThreshold/4) {
// Check that all of the users of the allocation are capable of being