diff options
Diffstat (limited to 'lib/Transforms/Scalar/DCE.cpp')
-rw-r--r-- | lib/Transforms/Scalar/DCE.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/Transforms/Scalar/DCE.cpp b/lib/Transforms/Scalar/DCE.cpp index 163c2b0..9cad236 100644 --- a/lib/Transforms/Scalar/DCE.cpp +++ b/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; } |