[llvm-commits] CVS: llvm/lib/Transforms/Scalar/ADCE.cpp

Chris Lattner lattner at cs.uiuc.edu
Sat Apr 10 02:02:00 PDT 2004


Changes in directory llvm/lib/Transforms/Scalar:

ADCE.cpp updated: 1.72 -> 1.73

---
Log message:

Correctly update counters


---
Diffs of the changes:  (+11 -5)

Index: llvm/lib/Transforms/Scalar/ADCE.cpp
diff -u llvm/lib/Transforms/Scalar/ADCE.cpp:1.72 llvm/lib/Transforms/Scalar/ADCE.cpp:1.73
--- llvm/lib/Transforms/Scalar/ADCE.cpp:1.72	Sat Apr 10 01:53:09 2004
+++ llvm/lib/Transforms/Scalar/ADCE.cpp	Sat Apr 10 02:02:02 2004
@@ -144,13 +144,16 @@
         // #arguments != #predecessors, so we remove them now.
         //
         PN->replaceAllUsesWith(Constant::getNullValue(PN->getType()));
+
+      } else {
+        if (isa<CallInst>(I))
+          ++NumCallRemoved;
+        else
+          ++NumInstRemoved;
         
         // Delete the instruction...
-        I = BB->getInstList().erase(I);
+        BB->getInstList().erase(I++);
         Changed = true;
-        ++NumInstRemoved;
-      } else {
-        ++I;
       }
     } else {
       ++I;
@@ -497,8 +500,11 @@
       for (BasicBlock::iterator II = BI->begin(); II != --BI->end(); )
         if (!LiveSet.count(II)) {             // Is this instruction alive?
           // Nope... remove the instruction from it's basic block...
+          if (isa<CallInst>(II))
+            ++NumCallRemoved;
+          else
+            ++NumInstRemoved;
           II = BI->getInstList().erase(II);
-          ++NumInstRemoved;
           MadeChanges = true;
         } else {
           ++II;





More information about the llvm-commits mailing list