summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar/SROA.cpp
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2012-09-18 22:37:19 +0000
committerChandler Carruth <chandlerc@gmail.com>2012-09-18 22:37:19 +0000
commit3f882d4cf5dca628ec749df723b0fda7f88f50a9 (patch)
tree5a9e0665a7866bd92f227668f36b35f2a0646432 /llvm/lib/Transforms/Scalar/SROA.cpp
parentf358791e270797cae3284955012223c8d767022b (diff)
downloadbcm5719-llvm-3f882d4cf5dca628ec749df723b0fda7f88f50a9.tar.gz
bcm5719-llvm-3f882d4cf5dca628ec749df723b0fda7f88f50a9.zip
Fix the last crasher I've gotten a reproduction for in SROA. This one
from the dragonegg build bots when we turned on the full version of the pass. Included a much reduced test case for this pesky bug, despite bugpoint's uncooperative behavior. Also, I audited all the similar code I could find and didn't spot any other cases where this mistake cropped up. llvm-svn: 164178
Diffstat (limited to 'llvm/lib/Transforms/Scalar/SROA.cpp')
-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 c959560b188..3b0cb383380 100644
--- a/llvm/lib/Transforms/Scalar/SROA.cpp
+++ b/llvm/lib/Transforms/Scalar/SROA.cpp
@@ -1487,6 +1487,8 @@ static Value *getNaturalGEPWithOffset(IRBuilder<> &IRB, const TargetData &TD,
return 0;
Type *ElementTy = Ty->getElementType();
+ if (!ElementTy->isSized())
+ return 0; // We can't GEP through an unsized element.
APInt ElementSize(Offset.getBitWidth(), TD.getTypeAllocSize(ElementTy));
if (ElementSize == 0)
return 0; // Zero-length arrays can't help us build a natural GEP.
OpenPOWER on IntegriCloud