[llvm] b2daeb9 - [ConstraintElimination] Re-enable debug print when adding facts. (NFC)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 3 12:56:37 PDT 2022


Author: Florian Hahn
Date: 2022-10-03T20:51:58+01:00
New Revision: b2daeb9706c24180b5779274d650a9c2467577ab

URL: https://github.com/llvm/llvm-project/commit/b2daeb9706c24180b5779274d650a9c2467577ab
DIFF: https://github.com/llvm/llvm-project/commit/b2daeb9706c24180b5779274d650a9c2467577ab.diff

LOG: [ConstraintElimination] Re-enable debug print when adding facts. (NFC)

Also add test coverage for important debug output.

Added: 
    

Modified: 
    llvm/lib/Transforms/Scalar/ConstraintElimination.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Scalar/ConstraintElimination.cpp b/llvm/lib/Transforms/Scalar/ConstraintElimination.cpp
index 6cfe83934b55d..2b87b0155ec00 100644
--- a/llvm/lib/Transforms/Scalar/ConstraintElimination.cpp
+++ b/llvm/lib/Transforms/Scalar/ConstraintElimination.cpp
@@ -629,7 +629,9 @@ void ConstraintInfo::addFact(CmpInst::Predicate Pred, Value *A, Value *B,
   if (!R.isValid(*this))
     return;
 
-  //LLVM_DEBUG(dbgs() << "Adding " << *Condition << " " << IsNegated << "\n");
+  LLVM_DEBUG(dbgs() << "Adding '" << CmpInst::getPredicateName(Pred) << " ";
+             A->printAsOperand(dbgs(), false); dbgs() << ", ";
+             B->printAsOperand(dbgs(), false); dbgs() << "'\n");
   bool Added = false;
   assert(CmpInst::isSigned(Pred) == R.IsSigned &&
          "condition and constraint signs must match");
@@ -651,6 +653,7 @@ void ConstraintInfo::addFact(CmpInst::Predicate Pred, Value *A, Value *B,
     LLVM_DEBUG({
       dbgs() << "  constraint: ";
       dumpWithNames(R.Coefficients, getValue2Index(R.IsSigned));
+      dbgs() << "\n";
     });
 
     DFSInStack.emplace_back(NumIn, NumOut, R.IsSigned, ValuesToRelease);
@@ -797,6 +800,7 @@ static bool eliminateConstraints(Function &F, DominatorTree &DT) {
         if (!Cmp)
           continue;
 
+        LLVM_DEBUG(dbgs() << "Checking " << *Cmp << "\n");
         DenseMap<Value *, unsigned> NewIndices;
         auto R = Info.getConstraint(Cmp, NewIndices);
         if (R.IsEq || R.empty() || !NewIndices.empty() || !R.isValid(Info))


        


More information about the llvm-commits mailing list