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:
d2f0db1
)
simplify this logic.
author
Chris Lattner
<sabre@nondot.org>
Thu, 27 Nov 2008 22:46:09 +0000
(22:46 +0000)
committer
Chris Lattner
<sabre@nondot.org>
Thu, 27 Nov 2008 22:46:09 +0000
(22:46 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60189
91177308
-0d34-0410-b5e6-
96231b3b80d8
lib/Transforms/Scalar/DCE.cpp
patch
|
blob
|
history
diff --git
a/lib/Transforms/Scalar/DCE.cpp
b/lib/Transforms/Scalar/DCE.cpp
index fb9a0e04fd6243a9380f2d2f0f902cbb8790854a..a5990ee79e89d863b79eafba4e40f1687b2351d3 100644
(file)
--- a/
lib/Transforms/Scalar/DCE.cpp
+++ b/
lib/Transforms/Scalar/DCE.cpp
@@
-39,12
+39,14
@@
namespace {
DeadInstElimination() : BasicBlockPass(intptr_t(&ID)) {}
virtual bool runOnBasicBlock(BasicBlock &BB) {
bool Changed = false;
- for (BasicBlock::iterator DI = BB.begin(); DI != BB.end(); )
- if (dceInstruction(DI)) {
+ for (BasicBlock::iterator DI = BB.begin(); DI != BB.end(); ) {
+ Instruction *Inst = DI++;
+ if (isInstructionTriviallyDead(Inst)) {
+ Inst->eraseFromParent();
Changed = true;
++DIEEliminated;
- }
else
- ++DI;
+ }
+ }
return Changed;
}