From 95d9915c5c400b09e262a4920514360d69ccd731 Mon Sep 17 00:00:00 2001 From: Sanjoy Das Date: Thu, 6 Aug 2015 20:43:28 +0000 Subject: [PATCH] [IndVars] Improved logging under DEBUG(); NFC. Before this, we'd print the modified comparision in the "Simplified comparison" case. That looked misleading. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244264 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/Utils/SimplifyIndVar.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/lib/Transforms/Utils/SimplifyIndVar.cpp b/lib/Transforms/Utils/SimplifyIndVar.cpp index b3055a492be..fa0459f62c9 100644 --- a/lib/Transforms/Utils/SimplifyIndVar.cpp +++ b/lib/Transforms/Utils/SimplifyIndVar.cpp @@ -169,18 +169,16 @@ void SimplifyIndvar::eliminateIVComparison(ICmpInst *ICmp, Value *IVOperand) { ICmpInst::Predicate InvariantPredicate; const SCEV *InvariantLHS, *InvariantRHS; - const char *Verb = nullptr; - // If the condition is always true or always false, replace it with // a constant value. if (SE->isKnownPredicate(Pred, S, X)) { ICmp->replaceAllUsesWith(ConstantInt::getTrue(ICmp->getContext())); DeadInsts.emplace_back(ICmp); - Verb = "Eliminated"; + DEBUG(dbgs() << "INDVARS: Eliminated comparison: " << *ICmp << '\n'); } else if (SE->isKnownPredicate(ICmpInst::getInversePredicate(Pred), S, X)) { ICmp->replaceAllUsesWith(ConstantInt::getFalse(ICmp->getContext())); DeadInsts.emplace_back(ICmp); - Verb = "Eliminated"; + DEBUG(dbgs() << "INDVARS: Eliminated comparison: " << *ICmp << '\n'); } else if (isa(IVOperand) && SE->isLoopInvariantPredicate(Pred, S, X, ICmpLoop, InvariantPredicate, InvariantLHS, @@ -218,14 +216,13 @@ void SimplifyIndvar::eliminateIVComparison(ICmpInst *ICmp, Value *IVOperand) { // for now. return; - Verb = "Simplified"; + DEBUG(dbgs() << "INDVARS: Simplified comparison: " << *ICmp << '\n'); ICmp->setPredicate(InvariantPredicate); ICmp->setOperand(0, NewLHS); ICmp->setOperand(1, NewRHS); } else return; - DEBUG(dbgs() << "INDVARS: " << Verb << " comparison: " << *ICmp << '\n'); ++NumElimCmp; Changed = true; } -- 2.34.1