Be a bit more aggressive in bailing out of this routine. Spotted by

inspection by Duncan during review. My suspicion is that we would still
have returned 0 anyways in this case, but doing it sooner is better.

llvm-svn: 163895
This commit is contained in:
Chandler Carruth 2012-09-14 10:30:42 +00:00
parent dd3cea898f
commit cabd96cbaa
1 changed files with 1 additions and 1 deletions

View File

@ -1336,7 +1336,7 @@ static Value *getNaturalGEPRecursively(IRBuilder<> &IRB, const TargetData &TD,
const StructLayout *SL = TD.getStructLayout(STy);
uint64_t StructOffset = Offset.getZExtValue();
if (StructOffset > SL->getSizeInBytes())
if (StructOffset >= SL->getSizeInBytes())
return 0;
unsigned Index = SL->getElementContainingOffset(StructOffset);
Offset -= APInt(Offset.getBitWidth(), SL->getElementOffset(Index));