- Somehow I forgot about one / une.
[oota-llvm.git] / lib / Transforms / Scalar / DCE.cpp
index a63fcb6589f7ae2e9b10ebd67693797d269ccdac..fb9a0e04fd6243a9380f2d2f0f902cbb8790854a 100644 (file)
@@ -69,7 +69,7 @@ namespace {
   //
   struct DCE : public FunctionPass {
     static char ID; // Pass identification, replacement for typeid
-    DCE() : FunctionPass((intptr_t)&ID) {}
+    DCE() : FunctionPass(&ID) {}
 
     virtual bool runOnFunction(Function &F);
 
@@ -111,11 +111,12 @@ bool DCE::runOnFunction(Function &F) {
 
       // Remove the instruction from the worklist if it still exists in it.
       for (std::vector<Instruction*>::iterator WI = WorkList.begin();
-           WI != WorkList.end(); ++WI)
-        if (*WI == I) {
+           WI != WorkList.end(); ) {
+        if (*WI == I)
           WI = WorkList.erase(WI);
-          --WI;
-        }
+        else
+          ++WI;
+      }
 
       MadeChange = true;
       ++DCEEliminated;