[llvm] a2b5904 - [SchedModels] Improve diagnostics. NFC

Evgeny Leviant via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 24 02:52:41 PST 2020


Author: Evgeny Leviant
Date: 2020-11-24T13:52:32+03:00
New Revision: a2b59048d99040179c0106e86730f8a45f0e2286

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

LOG: [SchedModels] Improve diagnostics. NFC

Added: 
    

Modified: 
    llvm/utils/TableGen/CodeGenSchedule.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/utils/TableGen/CodeGenSchedule.cpp b/llvm/utils/TableGen/CodeGenSchedule.cpp
index 3ba1b797f6a8..030e16b744a8 100644
--- a/llvm/utils/TableGen/CodeGenSchedule.cpp
+++ b/llvm/utils/TableGen/CodeGenSchedule.cpp
@@ -1724,14 +1724,22 @@ static void addSequences(CodeGenSchedModels &SchedModels,
       Result.push_back(SchedModels.findOrInsertRW(S, IsRead));
 }
 
+#ifndef NDEBUG
+static void dumpRecVec(const RecVec &RV) {
+  for (const Record *R : RV)
+    dbgs() << R->getName() << ", ";
+}
+#endif
+
 static void dumpTransition(const CodeGenSchedModels &SchedModels,
                            const CodeGenSchedClass &FromSC,
-                           const CodeGenSchedTransition &SCTrans) {
+                           const CodeGenSchedTransition &SCTrans,
+                           const RecVec &Preds) {
   LLVM_DEBUG(dbgs() << "Adding transition from " << FromSC.Name << "("
                     << FromSC.Index << ") to "
                     << SchedModels.getSchedClass(SCTrans.ToClassIdx).Name << "("
-                    << SCTrans.ToClassIdx << ")"
-                    << " on processor indices: (";
+                    << SCTrans.ToClassIdx << ") on pred term: (";
+             dumpRecVec(Preds); dbgs() << ") on processor indices: (";
              dumpIdxVec(SCTrans.ProcIndices); dbgs() << ")\n");
 }
 // Create a new SchedClass for each variant found by inferFromRW. Pass
@@ -1759,7 +1767,7 @@ static void inferFromTransitions(ArrayRef<PredTransition> LastTransitions,
     SCTrans.ToClassIdx =
         SchedModels.addSchedClass(/*ItinClassDef=*/nullptr, OperWritesVariant,
                                   OperReadsVariant, I->ProcIndices);
-    dumpTransition(SchedModels, FromSC, SCTrans);
+
     // The final PredTerm is unique set of predicates guarding the transition.
     RecVec Preds;
     transform(I->PredTerm, std::back_inserter(Preds),
@@ -1767,6 +1775,7 @@ static void inferFromTransitions(ArrayRef<PredTransition> LastTransitions,
                 return P.Predicate;
               });
     Preds.erase(std::unique(Preds.begin(), Preds.end()), Preds.end());
+    dumpTransition(SchedModels, FromSC, SCTrans, Preds);
     SCTrans.PredTerm = std::move(Preds);
     SchedModels.getSchedClass(FromClassIdx)
         .Transitions.push_back(std::move(SCTrans));


        


More information about the llvm-commits mailing list