aboutsummaryrefslogtreecommitdiff
path: root/lib/Transforms
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Transforms')
-rw-r--r--lib/Transforms/Scalar/ScalarReplAggregates.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/Transforms/Scalar/ScalarReplAggregates.cpp b/lib/Transforms/Scalar/ScalarReplAggregates.cpp
index 6857162dc4..4f99ee8e6e 100644
--- a/lib/Transforms/Scalar/ScalarReplAggregates.cpp
+++ b/lib/Transforms/Scalar/ScalarReplAggregates.cpp
@@ -255,9 +255,12 @@ bool SROA::performScalarRepl(Function &F) {
// value cannot be decomposed at all.
uint64_t AllocaSize = TD->getTypeAllocSize(AI->getAllocatedType());
+ // Do not promote [0 x %struct].
+ if (AllocaSize == 0) continue;
+
// 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 into more than "32" separate vars.