<< ", " << NewSlices.back().endOffset() << "): " << *PLoad
<< "\n");
+ // See if we've handled all the splits.
+ if (Idx >= Size)
+ break;
+
// Setup the next partition.
PartOffset = Offsets.Splits[Idx];
++Idx;
- if (Idx > Size)
- break;
PartSize = (Idx < Size ? Offsets.Splits[Idx] : LoadSize) - PartOffset;
}
continue;
}
- Instruction *StoreBasePtr = cast<Instruction>(SI->getPointerOperand());
+ Value *StoreBasePtr = SI->getPointerOperand();
IRB.SetInsertPoint(BasicBlock::iterator(SI));
DEBUG(dbgs() << " Splitting store of load: " << *SI << "\n");
assert(BaseOffset + StoreSize > BaseOffset &&
"Cannot represent alloca access size using 64-bit integers!");
- Instruction *LoadBasePtr = cast<Instruction>(LI->getPointerOperand());
+ Value *LoadBasePtr = LI->getPointerOperand();
Instruction *StoreBasePtr = cast<Instruction>(SI->getPointerOperand());
DEBUG(dbgs() << " Splitting store: " << *SI << "\n");
DEBUG(dbgs() << " of split load: " << *PLoad << "\n");
}
+ // See if we've finished all the splits.
+ if (Idx >= Size)
+ break;
+
// Setup the next partition.
PartOffset = Offsets.Splits[Idx];
++Idx;
- if (Idx > Size)
- break;
PartSize = (Idx < Size ? Offsets.Splits[Idx] : StoreSize) - PartOffset;
}