diff options
| author | Chris Lattner <sabre@nondot.org> | 2007-05-24 18:43:04 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2007-05-24 18:43:04 +0000 |
| commit | 80c94a4a047bc2641c26a3324501aa7244a813f8 (patch) | |
| tree | 3d913b6b507770d7a794e7dad673aee4dfd724f1 | |
| parent | 49a34fcca755db7a1300d12636282992f2cf1740 (diff) | |
| download | bcm5719-llvm-80c94a4a047bc2641c26a3324501aa7244a813f8.tar.gz bcm5719-llvm-80c94a4a047bc2641c26a3324501aa7244a813f8.zip | |
Fix PR1446 by not scalarrepl'ing giant structures.
llvm-svn: 37326
| -rw-r--r-- | llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp b/llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp index 18e05bb2e3c..977f22ebf61 100644 --- a/llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp +++ b/llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp @@ -148,6 +148,8 @@ bool SROA::performScalarRepl(Function &F) { 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 @@ bool SROA::performScalarRepl(Function &F) { // 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)) { |

