projects
/
oota-llvm.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
cc713a3
)
Constant propagation should remove the dead instructions
author
Chris Lattner
<sabre@nondot.org>
Tue, 13 Apr 2004 19:28:20 +0000
(19:28 +0000)
committer
Chris Lattner
<sabre@nondot.org>
Tue, 13 Apr 2004 19:28:20 +0000
(19:28 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12917
91177308
-0d34-0410-b5e6-
96231b3b80d8
lib/Transforms/Scalar/ConstantProp.cpp
patch
|
blob
|
history
diff --git
a/lib/Transforms/Scalar/ConstantProp.cpp
b/lib/Transforms/Scalar/ConstantProp.cpp
index d9a297cdf1f4e3b6915a7393e1da17519aa7c99d..f1f7a4422211e32cf0950d48ac2beb045cccd677 100644
(file)
--- 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;