Constant propagation should remove the dead instructions

llvm-svn: 12917
This commit is contained in:
Chris Lattner 2004-04-13 19:28:20 +00:00
parent e3debac3cd
commit d0dc6d5295
1 changed files with 4 additions and 0 deletions

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;