mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-28 06:24:57 +00:00
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@164178 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -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.
|
||||
|
Reference in New Issue
Block a user