diff options
author | David Greene <greened@obbligato.org> | 2007-12-17 17:39:51 +0000 |
---|---|---|
committer | David Greene <greened@obbligato.org> | 2007-12-17 17:39:51 +0000 |
commit | 2a5967b36a74378e7a8e37361ae87c8bac457d10 (patch) | |
tree | 6d015a977e911bbb7891c216a48e290cb749c659 /llvm/lib/Transforms/Scalar/DCE.cpp | |
parent | 05821322b4d86c4d8357cad56b5d0c0f7ea8b721 (diff) | |
download | bcm5719-llvm-2a5967b36a74378e7a8e37361ae87c8bac457d10.tar.gz bcm5719-llvm-2a5967b36a74378e7a8e37361ae87c8bac457d10.zip |
Fix GLIBCXX_DEBUG errors. Erase invalidates std::vector iterators
passed the erased element.
llvm-svn: 45099
Diffstat (limited to 'llvm/lib/Transforms/Scalar/DCE.cpp')
-rw-r--r-- | llvm/lib/Transforms/Scalar/DCE.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/Scalar/DCE.cpp b/llvm/lib/Transforms/Scalar/DCE.cpp index 163c2b00611..9cad2362954 100644 --- a/llvm/lib/Transforms/Scalar/DCE.cpp +++ b/llvm/lib/Transforms/Scalar/DCE.cpp @@ -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; } |