diff options
Diffstat (limited to 'llvm/lib/Transforms/Scalar/EarlyCSE.cpp')
-rw-r--r-- | llvm/lib/Transforms/Scalar/EarlyCSE.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Scalar/EarlyCSE.cpp b/llvm/lib/Transforms/Scalar/EarlyCSE.cpp index 9d0ef42e039..0b16e2703dc 100644 --- a/llvm/lib/Transforms/Scalar/EarlyCSE.cpp +++ b/llvm/lib/Transforms/Scalar/EarlyCSE.cpp @@ -582,6 +582,7 @@ bool EarlyCSE::processNode(DomTreeNode *Node) { // its simpler value. if (Value *V = SimplifyInstruction(Inst, DL, &TLI, &DT, &AC)) { DEBUG(dbgs() << "EarlyCSE Simplify: " << *Inst << " to: " << *V << '\n'); + bool Killed = false; if (!Inst->use_empty()) { Inst->replaceAllUsesWith(V); Changed = true; @@ -589,11 +590,12 @@ bool EarlyCSE::processNode(DomTreeNode *Node) { if (isInstructionTriviallyDead(Inst, &TLI)) { Inst->eraseFromParent(); Changed = true; + Killed = true; } - if (Changed) { + if (Changed) ++NumSimplify; + if (Killed) continue; - } } // If this is a simple instruction that we can value number, process it. |