[llvm-commits] CVS: llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp

Chris Lattner sabre at nondot.org
Thu May 24 11:43:27 PDT 2007



Changes in directory llvm/lib/Transforms/Scalar:

ScalarReplAggregates.cpp updated: 1.94 -> 1.95
---
Log message:

Fix PR1446: http://llvm.org/PR1446  by not scalarrepl'ing giant structures.


---
Diffs of the changes:  (+5 -1)

 ScalarReplAggregates.cpp |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletion(-)


Index: llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp
diff -u llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.94 llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.95
--- llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.94	Sun May  6 08:37:16 2007
+++ llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp	Thu May 24 13:43:04 2007
@@ -148,6 +148,8 @@
     if (AllocationInst *A = dyn_cast<AllocationInst>(I))
       WorkList.push_back(A);
 
+  const TargetData &TD = getAnalysis<TargetData>();
+  
   // Process the worklist
   bool Changed = false;
   while (!WorkList.empty()) {
@@ -177,7 +179,9 @@
     // value cannot be decomposed at all.
     if (!AI->isArrayAllocation() &&
         (isa<StructType>(AI->getAllocatedType()) ||
-         isa<ArrayType>(AI->getAllocatedType()))) {
+         isa<ArrayType>(AI->getAllocatedType())) &&
+        AI->getAllocatedType()->isSized() &&
+        TD.getTypeSize(AI->getAllocatedType()) < 128) {
       // Check that all of the users of the allocation are capable of being
       // transformed.
       switch (isSafeAllocaToScalarRepl(AI)) {






More information about the llvm-commits mailing list