diff options
Diffstat (limited to 'lib/Transforms')
-rw-r--r-- | lib/Transforms/Scalar/LoopIndexSplit.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/Transforms/Scalar/LoopIndexSplit.cpp b/lib/Transforms/Scalar/LoopIndexSplit.cpp index 48b45351a0..8053554c17 100644 --- a/lib/Transforms/Scalar/LoopIndexSplit.cpp +++ b/lib/Transforms/Scalar/LoopIndexSplit.cpp @@ -232,8 +232,8 @@ bool LoopIndexSplit::runOnLoop(Loop *IncomingLoop, LPPassManager &LPM_Ref) { return false; // First see if it is possible to eliminate loop itself or not. - for (SmallVector<SplitInfo, 4>::iterator SI = SplitData.begin(); - SI != SplitData.end();) { + for (SmallVector<SplitInfo, 4>::iterator SI = SplitData.begin(), + E = SplitData.end(); SI != E;) { SplitInfo &SD = *SI; ICmpInst *CI = dyn_cast<ICmpInst>(SD.SplitCondition); if (SD.SplitCondition->getOpcode() == Instruction::And) { @@ -244,7 +244,8 @@ bool LoopIndexSplit::runOnLoop(Loop *IncomingLoop, LPPassManager &LPM_Ref) { return Changed; } else { SmallVector<SplitInfo, 4>::iterator Delete_SI = SI; - SI = SplitData.erase(Delete_SI); + ++SI; + SplitData.erase(Delete_SI); } } else if (CI && CI->getPredicate() == ICmpInst::ICMP_EQ) { @@ -255,7 +256,8 @@ bool LoopIndexSplit::runOnLoop(Loop *IncomingLoop, LPPassManager &LPM_Ref) { return Changed; } else { SmallVector<SplitInfo, 4>::iterator Delete_SI = SI; - SI = SplitData.erase(Delete_SI); + ++SI; + SplitData.erase(Delete_SI); } } else ++SI; |