projects
/
oota-llvm.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
df5cf20
)
Avoid potential iterator invalidation problems.
author
Owen Anderson
<resistor@mac.com>
Mon, 30 Jul 2007 21:26:39 +0000
(21:26 +0000)
committer
Owen Anderson
<resistor@mac.com>
Mon, 30 Jul 2007 21:26:39 +0000
(21:26 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40607
91177308
-0d34-0410-b5e6-
96231b3b80d8
lib/Transforms/Scalar/GVN.cpp
patch
|
blob
|
history
diff --git
a/lib/Transforms/Scalar/GVN.cpp
b/lib/Transforms/Scalar/GVN.cpp
index fee0eedcc770770bba0c7f16096954eac676f53d..42e9ee8900fcfa47abc51475647b79917bd2f87b 100644
(file)
--- a/
lib/Transforms/Scalar/GVN.cpp
+++ b/
lib/Transforms/Scalar/GVN.cpp
@@
-895,11
+895,14
@@
bool GVN::runOnFunction(Function &F) {
currAvail = availableOut[DI->getIDom()->getBlock()];
for (BasicBlock::iterator BI = BB->begin(), BE = BB->end();
- BI != BE;
++BI
) {
+ BI != BE; ) {
changed_function |= processInstruction(BI, currAvail, lastSeenLoad, toErase);
NumGVNInstr += toErase.size();
+ // Avoid iterator invalidation
+ ++BI;
+
for (SmallVector<Instruction*, 4>::iterator I = toErase.begin(),
E = toErase.end(); I != E; ++I)
(*I)->eraseFromParent();