Constant propagation should remove the dead instructions

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12917 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2004-04-13 19:28:20 +00:00
parent cc713a343e
commit 4647b7cd69

View File

@ -67,6 +67,10 @@ bool ConstantPropagation::runOnFunction(Function &F) {
// 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;