From 7139406707eb3869183fd6a3329fe4a77d309692 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Thu, 24 May 2007 18:43:04 +0000 Subject: [PATCH] Fix PR1446 by not scalarrepl'ing giant structures. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37326 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/Scalar/ScalarReplAggregates.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/Transforms/Scalar/ScalarReplAggregates.cpp b/lib/Transforms/Scalar/ScalarReplAggregates.cpp index 18e05bb2e3c..977f22ebf61 100644 --- a/lib/Transforms/Scalar/ScalarReplAggregates.cpp +++ b/lib/Transforms/Scalar/ScalarReplAggregates.cpp @@ -148,6 +148,8 @@ bool SROA::performScalarRepl(Function &F) { if (AllocationInst *A = dyn_cast(I)) WorkList.push_back(A); + const TargetData &TD = getAnalysis(); + // 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(AI->getAllocatedType()) || - isa(AI->getAllocatedType()))) { + isa(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)) {