mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-05 12:31:33 +00:00
Avoid potential iterator invalidation problems.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40607 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
df5cf2074c
commit
891eecb040
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user