summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-01-13 23:26:48 +0000
committerChris Lattner <sabre@nondot.org>2005-01-13 23:26:48 +0000
commitd35d210ea08cc048f5faebcdf7df4d7634972321 (patch)
treeed3cb629e25036dcb504fd4c99363931ea823384
parent8ea1e8b982c6d3519469af4d39db07a643e9c196 (diff)
downloadbcm5719-llvm-d35d210ea08cc048f5faebcdf7df4d7634972321.tar.gz
bcm5719-llvm-d35d210ea08cc048f5faebcdf7df4d7634972321.zip
Do not overrun iterators. This fixes a 176.gcc crash
llvm-svn: 19541
-rw-r--r--llvm/lib/Transforms/Scalar/InstructionCombining.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
index b8ff3d4e7e7..e8f52d11573 100644
--- a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
+++ b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
@@ -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)) {
OpenPOWER on IntegriCloud