[llvm] r244264 - [IndVars] Improved logging under DEBUG(); NFC.

Sanjoy Das via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 6 13:43:28 PDT 2015


Author: sanjoy
Date: Thu Aug  6 15:43:28 2015
New Revision: 244264

URL: http://llvm.org/viewvc/llvm-project?rev=244264&view=rev
Log:
[IndVars] Improved logging under DEBUG(); NFC.

Before this, we'd print the modified comparision in the "Simplified
comparison" case.  That looked misleading.

Modified:
    llvm/trunk/lib/Transforms/Utils/SimplifyIndVar.cpp

Modified: llvm/trunk/lib/Transforms/Utils/SimplifyIndVar.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/SimplifyIndVar.cpp?rev=244264&r1=244263&r2=244264&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/SimplifyIndVar.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/SimplifyIndVar.cpp Thu Aug  6 15:43:28 2015
@@ -169,18 +169,16 @@ void SimplifyIndvar::eliminateIVComparis
   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<PHINode>(IVOperand) &&
              SE->isLoopInvariantPredicate(Pred, S, X, ICmpLoop,
                                           InvariantPredicate, InvariantLHS,
@@ -218,14 +216,13 @@ void SimplifyIndvar::eliminateIVComparis
       // 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;
 }




More information about the llvm-commits mailing list