[llvm-commits] [llvm] r65755 - /llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp

Chris Lattner sabre at nondot.org
Sat Feb 28 18:26:47 PST 2009


Author: lattner
Date: Sat Feb 28 20:26:47 2009
New Revision: 65755

URL: http://llvm.org/viewvc/llvm-project?rev=65755&view=rev
Log:
hoist the check for alloca size up so that it controls CanConvertToScalar 
as well as isSafeAllocaToScalarRepl.

Modified:
    llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp

Modified: llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp?rev=65755&r1=65754&r2=65755&view=diff

==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp Sat Feb 28 20:26:47 2009
@@ -253,11 +253,13 @@
     // (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





More information about the llvm-commits mailing list