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

Chris Lattner lattner at cs.uiuc.edu
Tue Apr 13 14:29:01 PDT 2004


Changes in directory llvm/lib/Transforms/Scalar:

ConstantProp.cpp updated: 1.46 -> 1.47

---
Log message:

Constant propagation should remove the dead instructions


---
Diffs of the changes:  (+4 -0)

Index: llvm/lib/Transforms/Scalar/ConstantProp.cpp
diff -u llvm/lib/Transforms/Scalar/ConstantProp.cpp:1.46 llvm/lib/Transforms/Scalar/ConstantProp.cpp:1.47
--- llvm/lib/Transforms/Scalar/ConstantProp.cpp:1.46	Mon Jan 12 13:15:20 2004
+++ llvm/lib/Transforms/Scalar/ConstantProp.cpp	Tue Apr 13 14:28:20 2004
@@ -67,6 +67,10 @@
         // Replace all of the uses of a variable with uses of the constant.
         I->replaceAllUsesWith(C);
 
+        // Remove the dead instruction.
+        WorkList.erase(I);
+        I->getParent()->getInstList().erase(I);
+
         // We made a change to the function...
         Changed = true;
         ++NumInstKilled;





More information about the llvm-commits mailing list