diff options
author | Chris Lattner <sabre@nondot.org> | 2004-04-13 19:28:20 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2004-04-13 19:28:20 +0000 |
commit | 4647b7cd6929990ff174f0dd7cbfda5ab40df850 (patch) | |
tree | a998eeea7856e7ac83e83557fa88f8f3134c2750 /lib | |
parent | cc713a343e4e3be2bb1ea790000c784e1e9f8017 (diff) | |
download | external_llvm-4647b7cd6929990ff174f0dd7cbfda5ab40df850.zip external_llvm-4647b7cd6929990ff174f0dd7cbfda5ab40df850.tar.gz external_llvm-4647b7cd6929990ff174f0dd7cbfda5ab40df850.tar.bz2 |
Constant propagation should remove the dead instructions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12917 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Transforms/Scalar/ConstantProp.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/Transforms/Scalar/ConstantProp.cpp b/lib/Transforms/Scalar/ConstantProp.cpp index d9a297c..f1f7a44 100644 --- a/lib/Transforms/Scalar/ConstantProp.cpp +++ b/lib/Transforms/Scalar/ConstantProp.cpp @@ -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; |