mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 03:33:20 +01:00
Do not overrun iterators. This fixes a 176.gcc crash
llvm-svn: 19541
This commit is contained in:
parent
eff86ebbc3
commit
283b7d9809
@ -2104,10 +2104,9 @@ static Value *EmitGEPOffset(User *GEP, Instruction &I, InstCombiner &IC) {
|
||||
uint64_t PtrSizeMask = ~0ULL;
|
||||
PtrSizeMask >>= 64-(TD.getPointerSize()*8);
|
||||
|
||||
++GTI; // Measure type stepping over.
|
||||
for (unsigned i = 1, e = GEP->getNumOperands(); i != e; ++i, ++GTI) {
|
||||
Value *Op = GEP->getOperand(i);
|
||||
uint64_t Size = TD.getTypeSize(*GTI) & PtrSizeMask;
|
||||
uint64_t Size = TD.getTypeSize(GTI.getIndexedType()) & PtrSizeMask;
|
||||
Constant *Scale = ConstantExpr::getCast(ConstantUInt::get(UIntPtrTy, Size),
|
||||
SIntPtrTy);
|
||||
if (Constant *OpC = dyn_cast<Constant>(Op)) {
|
||||
|
Loading…
Reference in New Issue
Block a user