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)) {