summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2012-10-09 01:58:35 +0000
committerChandler Carruth <chandlerc@gmail.com>2012-10-09 01:58:35 +0000
commit503eb2bb49f05c762fd79e42cb96ac6e86f0691e (patch)
tree75ff291c40c9f0bb16770b9f55057a41539f3660 /llvm/lib/Transforms
parent07cee6efc9f80d76df61c286485302bf0ff947de (diff)
downloadbcm5719-llvm-503eb2bb49f05c762fd79e42cb96ac6e86f0691e.tar.gz
bcm5719-llvm-503eb2bb49f05c762fd79e42cb96ac6e86f0691e.zip
Fix PR14034, an infloop / heap corruption / crash bug in the new SROA.
Thanks to Benjamin for the raw test case. This one took about 50 times longer to reduce than to fix. =/ llvm-svn: 165476
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/Scalar/SROA.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Scalar/SROA.cpp b/llvm/lib/Transforms/Scalar/SROA.cpp
index b2793893b46..ca762514929 100644
--- a/llvm/lib/Transforms/Scalar/SROA.cpp
+++ b/llvm/lib/Transforms/Scalar/SROA.cpp
@@ -1786,6 +1786,8 @@ static Value *getNaturalGEPWithType(IRBuilder<> &IRB, const DataLayout &TD,
ElementTy = SeqTy->getElementType();
Indices.push_back(IRB.getInt(APInt(TD.getPointerSizeInBits(), 0)));
} else if (StructType *STy = dyn_cast<StructType>(ElementTy)) {
+ if (STy->element_begin() == STy->element_end())
+ break; // Nothing left to descend into.
ElementTy = *STy->element_begin();
Indices.push_back(IRB.getInt32(0));
} else {
OpenPOWER on IntegriCloud