forked from OSchip/llvm-project
Constant propagation should remove the dead instructions
llvm-svn: 12917
This commit is contained in:
parent
e3debac3cd
commit
d0dc6d5295
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue