From e2bb5e31c8833897eebe1b4ddc892d5f771330fe Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sun, 1 Mar 2009 02:26:47 +0000 Subject: hoist the check for alloca size up so that it controls CanConvertToScalar as well as isSafeAllocaToScalarRepl. llvm-svn: 65755 --- llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp') diff --git a/llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp b/llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp index 3a4201bf81e..92ac76be74f 100644 --- a/llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp +++ b/llvm/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(AI->getAllocatedType()) || isa(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 -- cgit v1.2.3