[llvm-commits] [llvm] r49056 - /llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp
David Greene
greened at obbligato.org
Tue Apr 1 15:14:23 PDT 2008
Author: greened
Date: Tue Apr 1 17:14:23 2008
New Revision: 49056
URL: http://llvm.org/viewvc/llvm-project?rev=49056&view=rev
Log:
Iterators folloring a SmallVector erased element are invalidated so
don't access cached iterators from after the erased element.
Modified:
llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp
Modified: llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp?rev=49056&r1=49055&r2=49056&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp Tue Apr 1 17:14:23 2008
@@ -232,8 +232,8 @@
return false;
// First see if it is possible to eliminate loop itself or not.
- for (SmallVector<SplitInfo, 4>::iterator SI = SplitData.begin(),
- E = SplitData.end(); SI != E;) {
+ for (SmallVector<SplitInfo, 4>::iterator SI = SplitData.begin();
+ SI != SplitData.end();) {
SplitInfo &SD = *SI;
ICmpInst *CI = dyn_cast<ICmpInst>(SD.SplitCondition);
if (SD.SplitCondition->getOpcode() == Instruction::And) {
@@ -244,8 +244,7 @@
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) {
@@ -256,8 +255,7 @@
return Changed;
} else {
SmallVector<SplitInfo, 4>::iterator Delete_SI = SI;
- ++SI;
- SplitData.erase(Delete_SI);
+ SI = SplitData.erase(Delete_SI);
}
} else
++SI;
More information about the llvm-commits
mailing list