mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-01 00:33:09 +00:00
Fix GLIBCXX_DEBUG errors. Erase invalidates std::vector iterators
passed the erased element. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45099 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
0a1f248f28
commit
08d5fd9099
@ -109,11 +109,10 @@ bool DCE::runOnFunction(Function &F) {
|
||||
I->eraseFromParent();
|
||||
|
||||
// Remove the instruction from the worklist if it still exists in it.
|
||||
for (std::vector<Instruction*>::iterator WI = WorkList.begin(),
|
||||
E = WorkList.end(); WI != E; ++WI)
|
||||
for (std::vector<Instruction*>::iterator WI = WorkList.begin();
|
||||
WI != WorkList.end(); ++WI)
|
||||
if (*WI == I) {
|
||||
WorkList.erase(WI);
|
||||
--E;
|
||||
WI = WorkList.erase(WI);
|
||||
--WI;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user