[llvm] [MISched] Unify SUnit formatting among users (PR #229756)

via llvm-commits llvm-commits at lists.llvm.org
Sun Oct 11 01:03:49 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-backend-amdgpu

Author: Tomer Shafir (tomershafir)

<details>
<summary>Changes</summary>

This patch migrates diverging SUnit formats, that form a minority in the codebase, to a single unified format dictated by the new SUnit's operator<<.

---

Patch is 31.39 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/229756.diff


14 Files Affected:

- (modified) llvm/lib/CodeGen/MachinePipeliner.cpp (+9-10) 
- (modified) llvm/lib/CodeGen/MachineScheduler.cpp (+8-8) 
- (modified) llvm/lib/CodeGen/ScheduleDAGInstrs.cpp (+3-3) 
- (modified) llvm/lib/CodeGen/SelectionDAG/ScheduleDAGFast.cpp (+6-6) 
- (modified) llvm/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp (+18-20) 
- (modified) llvm/lib/CodeGen/VLIWMachineScheduler.cpp (+5-5) 
- (modified) llvm/lib/Target/AMDGPU/AMDGPUIGroupLP.cpp (+1-1) 
- (modified) llvm/lib/Target/AMDGPU/GCNILPSched.cpp (+4-6) 
- (modified) llvm/lib/Target/AMDGPU/GCNMinRegStrategy.cpp (+2-3) 
- (modified) llvm/test/CodeGen/AArch64/misched-detail-resource-booking-01.mir (+22-22) 
- (modified) llvm/test/CodeGen/AArch64/misched-detail-resource-booking-02.mir (+3-3) 
- (modified) llvm/test/CodeGen/SystemZ/misched-prera-cmp-elim.mir (+1-1) 
- (modified) llvm/test/CodeGen/SystemZ/misched-prera-latencies.mir (+1-1) 
- (modified) llvm/test/CodeGen/SystemZ/misched-prera-loads.mir (+15-15) 


``````````diff
diff --git a/llvm/lib/CodeGen/MachinePipeliner.cpp b/llvm/lib/CodeGen/MachinePipeliner.cpp
index 416a754aa9cbd..be68d42b187a7 100644
--- a/llvm/lib/CodeGen/MachinePipeliner.cpp
+++ b/llvm/lib/CodeGen/MachinePipeliner.cpp
@@ -2782,7 +2782,7 @@ void SwingSchedulerDAG::computeNodeOrder(NodeSetType &NodeSets) {
               maxHeight = I;
           }
           NodeOrder.insert(maxHeight);
-          LLVM_DEBUG(dbgs() << maxHeight->NodeNum << " ");
+          LLVM_DEBUG(dbgs() << *maxHeight << " ");
           R.remove(maxHeight);
           for (const auto &OE : DDG->getOutEdges(maxHeight)) {
             SUnit *SU = OE.getDst();
@@ -2833,7 +2833,7 @@ void SwingSchedulerDAG::computeNodeOrder(NodeSetType &NodeSets) {
               maxDepth = I;
           }
           NodeOrder.insert(maxDepth);
-          LLVM_DEBUG(dbgs() << maxDepth->NodeNum << " ");
+          LLVM_DEBUG(dbgs() << *maxDepth << " ");
           R.remove(maxDepth);
           if (Nodes.isExceedSU(maxDepth)) {
             Order = TopDown;
@@ -2878,7 +2878,7 @@ void SwingSchedulerDAG::computeNodeOrder(NodeSetType &NodeSets) {
   LLVM_DEBUG({
     dbgs() << "Node order: ";
     for (SUnit *I : NodeOrder)
-      dbgs() << " " << I->NodeNum << " ";
+      dbgs() << " " << *I << " ";
     dbgs() << "\n";
   });
 }
@@ -2926,7 +2926,7 @@ bool SwingSchedulerDAG::schedulePipeline(SMSchedule &Schedule) {
       Schedule.computeStart(SU, &EarlyStart, &LateStart, II, this);
       LLVM_DEBUG({
         dbgs() << "\n";
-        dbgs() << "Inst (" << SU->NodeNum << ") ";
+        dbgs() << *SU << " ";
         SU->getInstr()->dump();
         dbgs() << "\n";
       });
@@ -3842,9 +3842,8 @@ void SwingSchedulerDAG::checkValidNodeOrder(const NodeSetType &Circuits) const {
         NumNodeOrderIssues++;
         LLVM_DEBUG(dbgs() << "Predecessor ");
       }
-      LLVM_DEBUG(dbgs() << Pred->NodeNum << " and successor " << Succ->NodeNum
-                        << " are scheduled before node " << SU->NodeNum
-                        << "\n");
+      LLVM_DEBUG(dbgs() << *Pred << " and successor " << *Succ
+                        << " are scheduled before node " << *SU << "\n");
     }
   }
 
@@ -3976,7 +3975,7 @@ void SMSchedule::print(raw_ostream &os) const {
     const_sched_iterator cycleInstrs = ScheduledInstrs.find(cycle);
     for (SUnit *CI : cycleInstrs->second) {
       os << "cycle " << cycle << " (" << stageScheduled(CI) << ") ";
-      os << "(" << CI->NodeNum << ") ";
+      os << *CI << " ";
       CI->getInstr()->print(os);
       os << "\n";
     }
@@ -4447,8 +4446,8 @@ bool SwingSchedulerDDG::isValidSchedule(const SMSchedule &Schedule) const {
     int MaxLateStart = CycleDst + Edge.getDistance() * II - Edge.getLatency();
     if (CycleSrc > MaxLateStart) {
       LLVM_DEBUG({
-        dbgs() << "Validation failed for edge from " << Src->NodeNum << " to "
-               << Dst->NodeNum << "\n";
+        dbgs() << "Validation failed for edge from " << *Src << " to " << *Dst
+               << "\n";
       });
       return false;
     }
diff --git a/llvm/lib/CodeGen/MachineScheduler.cpp b/llvm/lib/CodeGen/MachineScheduler.cpp
index 3f91f153b82e8..7e2c02a548a8d 100644
--- a/llvm/lib/CodeGen/MachineScheduler.cpp
+++ b/llvm/lib/CodeGen/MachineScheduler.cpp
@@ -1087,7 +1087,7 @@ void MachineSchedulerBase::scheduleRegions(ScheduleDAGInstrs &Scheduler,
 LLVM_DUMP_METHOD void ReadyQueue::dump() const {
   dbgs() << "Queue " << Name << ": ";
   for (const SUnit *SU : Queue)
-    dbgs() << SU->NodeNum << " ";
+    dbgs() << *SU << " ";
   dbgs() << "\n";
 }
 #endif
@@ -1438,8 +1438,8 @@ LLVM_DUMP_METHOD void ScheduleDAGMI::dumpScheduleTraceTopDown() const {
       dbgs() << "Missing SUnit\n";
       continue;
     }
-    std::string NodeName("SU(");
-    NodeName += std::to_string(SU->NodeNum) + ")";
+    std::string NodeName;
+    raw_string_ostream(NodeName) << *SU;
     dbgs() << llvm::left_justify(NodeName, HeaderColWidth);
     unsigned C = FirstCycle;
     for (; C <= LastCycle; ++C) {
@@ -1520,8 +1520,8 @@ LLVM_DUMP_METHOD void ScheduleDAGMI::dumpScheduleTraceBottomUp() const {
       dbgs() << "Missing SUnit\n";
       continue;
     }
-    std::string NodeName("SU(");
-    NodeName += std::to_string(SU->NodeNum) + ")";
+    std::string NodeName;
+    raw_string_ostream(NodeName) << *SU;
     dbgs() << llvm::left_justify(NodeName, HeaderColWidth);
     int C = FirstCycle;
     for (; C >= LastCycle; --C) {
@@ -4464,7 +4464,7 @@ void GenericScheduler::schedNode(SUnit *SU, bool IsTopNode) {
         ClusterInfo *TopCluster = DAG->getCluster(TopClusterID);
         dbgs() << "  Top Cluster: ";
         for (auto *N : *TopCluster)
-          dbgs() << N->NodeNum << '\t';
+          dbgs() << *N << '\t';
         dbgs() << '\n';
       }
     });
@@ -4479,7 +4479,7 @@ void GenericScheduler::schedNode(SUnit *SU, bool IsTopNode) {
         ClusterInfo *BotCluster = DAG->getCluster(BotClusterID);
         dbgs() << "  Bot Cluster: ";
         for (auto *N : *BotCluster)
-          dbgs() << N->NodeNum << '\t';
+          dbgs() << *N << '\t';
         dbgs() << '\n';
       }
     });
@@ -5054,7 +5054,7 @@ struct llvm::DOTGraphTraits<ScheduleDAGMI *> : public DefaultDOTGraphTraits {
     const ScheduleDAGMI *DAG = static_cast<const ScheduleDAGMI*>(G);
     const SchedDFSResult *DFS = DAG->hasVRegLiveness() ?
       static_cast<const ScheduleDAGMILive*>(G)->getDFSResult() : nullptr;
-    SS << "SU:" << SU->NodeNum;
+    SS << *SU;
     if (DFS)
       SS << " I:" << DFS->getNumInstrs(SU);
     return Str;
diff --git a/llvm/lib/CodeGen/ScheduleDAGInstrs.cpp b/llvm/lib/CodeGen/ScheduleDAGInstrs.cpp
index 0fc233ac596ae..549a952071757 100644
--- a/llvm/lib/CodeGen/ScheduleDAGInstrs.cpp
+++ b/llvm/lib/CodeGen/ScheduleDAGInstrs.cpp
@@ -1497,7 +1497,7 @@ class SchedDFSImpl {
 
   /// Sets each node's subtree ID to the representative ID and record
   /// connections between trees.
-  void finalize() {
+  void finalize(ArrayRef<SUnit> SUnits) {
     SubtreeClasses.compress();
     R.DFSTreeData.resize(SubtreeClasses.getNumClasses());
     assert(SubtreeClasses.getNumClasses() == RootSet.size()
@@ -1517,7 +1517,7 @@ class SchedDFSImpl {
     LLVM_DEBUG(dbgs() << R.getNumSubtrees() << " subtrees:\n");
     for (unsigned Idx = 0, End = R.DFSNodeData.size(); Idx != End; ++Idx) {
       R.DFSNodeData[Idx].SubtreeID = SubtreeClasses[Idx];
-      LLVM_DEBUG(dbgs() << "  SU(" << Idx << ") in tree "
+      LLVM_DEBUG(dbgs() << "  " << SUnits[Idx] << " in tree "
                         << R.DFSNodeData[Idx].SubtreeID << '\n');
     }
     for (const auto &[Pred, Succ] : ConnectionPairs) {
@@ -1663,7 +1663,7 @@ void SchedDFSResult::compute(ArrayRef<SUnit> SUnits) {
         break;
     }
   }
-  Impl.finalize();
+  Impl.finalize(SUnits);
 }
 
 /// The root of the given SubtreeID was just scheduled. For all subtrees
diff --git a/llvm/lib/CodeGen/SelectionDAG/ScheduleDAGFast.cpp b/llvm/lib/CodeGen/SelectionDAG/ScheduleDAGFast.cpp
index 0f67cee757407..7f1c505db3eb7 100644
--- a/llvm/lib/CodeGen/SelectionDAG/ScheduleDAGFast.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/ScheduleDAGFast.cpp
@@ -225,7 +225,7 @@ SUnit *ScheduleDAGFast::CopyAndMoveSuccessors(SUnit *SU) {
     if (!TII->unfoldMemoryOperand(*DAG, N, NewNodes))
       return nullptr;
 
-    LLVM_DEBUG(dbgs() << "Unfolding SU # " << SU->NodeNum << "\n");
+    LLVM_DEBUG(dbgs() << "Unfolding " << *SU << "\n");
     assert(NewNodes.size() == 2 && "Expected a load folding node!");
 
     N = NewNodes[1];
@@ -331,7 +331,7 @@ SUnit *ScheduleDAGFast::CopyAndMoveSuccessors(SUnit *SU) {
     SU = NewSU;
   }
 
-  LLVM_DEBUG(dbgs() << "Duplicating SU # " << SU->NodeNum << "\n");
+  LLVM_DEBUG(dbgs() << "Duplicating " << *SU << "\n");
   NewSU = Clone(SU);
 
   // New SUnit has the exact same predecessors.
@@ -570,14 +570,14 @@ void ScheduleDAGFast::ListScheduleBottomUp() {
           // Issue copies, these can be expensive cross register class copies.
           SmallVector<SUnit*, 2> Copies;
           InsertCopiesAndMoveSuccs(LRDef, Reg, DestRC, RC, Copies);
-          LLVM_DEBUG(dbgs() << "Adding an edge from SU # " << TrySU->NodeNum
-                            << " to SU #" << Copies.front()->NodeNum << "\n");
+          LLVM_DEBUG(dbgs() << "Adding an edge from " << *TrySU << " to "
+                            << *Copies.front() << "\n");
           AddPred(TrySU, SDep(Copies.front(), SDep::Artificial));
           NewDef = Copies.back();
         }
 
-        LLVM_DEBUG(dbgs() << "Adding an edge from SU # " << NewDef->NodeNum
-                          << " to SU #" << TrySU->NodeNum << "\n");
+        LLVM_DEBUG(dbgs() << "Adding an edge from " << *NewDef << " to "
+                          << *TrySU << "\n");
         LiveRegDefs[Reg] = NewDef;
         AddPred(NewDef, SDep(TrySU, SDep::Artificial));
         TrySU->isAvailable = false;
diff --git a/llvm/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp b/llvm/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp
index 7a527f8efe17c..0ff33e228a2c9 100644
--- a/llvm/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp
@@ -1035,7 +1035,7 @@ SUnit *ScheduleDAGRRList::TryUnfoldSU(SUnit *SU) {
     computeLatency(NewSU);
   }
 
-  LLVM_DEBUG(dbgs() << "Unfolding SU #" << SU->NodeNum << "\n");
+  LLVM_DEBUG(dbgs() << "Unfolding " << *SU << "\n");
 
   // Now that we are committed to unfolding replace DAG Uses.
   for (unsigned i = 0; i != NumVals; ++i)
@@ -1170,7 +1170,7 @@ SUnit *ScheduleDAGRRList::CopyAndMoveSuccessors(SUnit *SU) {
       return SU;
   }
 
-  LLVM_DEBUG(dbgs() << "    Duplicating SU #" << SU->NodeNum << "\n");
+  LLVM_DEBUG(dbgs() << "    Duplicating " << *SU << "\n");
   NewSU = CreateClone(SU);
 
   // New SUnit has the exact same predecessors.
@@ -1424,7 +1424,7 @@ void ScheduleDAGRRList::releaseInterferences(unsigned Reg) {
     // Furthermore, it may have been made available again, in which case it is
     // now already in the AvailableQueue.
     if (SU->isAvailable && !SU->NodeQueueId) {
-      LLVM_DEBUG(dbgs() << "    Repushing SU #" << SU->NodeNum << '\n');
+      LLVM_DEBUG(dbgs() << "    Repushing " << *SU << '\n');
       AvailableQueue->push(SU);
     }
     if (i < Interferences.size())
@@ -1448,7 +1448,7 @@ SUnit *ScheduleDAGRRList::PickNodeToScheduleBottomUp() {
       LLVM_DEBUG(dbgs() << "    Interfering reg ";
                  if (LRegs[0] == TRI->getNumRegs()) dbgs() << "CallResource";
                  else dbgs() << printReg(LRegs[0], TRI);
-                 dbgs() << " SU #" << CurSU->NodeNum << '\n');
+                 dbgs() << " " << *CurSU << '\n');
       auto [LRegsIter, LRegsInserted] = LRegsMap.try_emplace(CurSU, LRegs);
       if (LRegsInserted) {
         CurSU->isPending = true;  // This SU is not in AvailableQueue right now.
@@ -1550,14 +1550,14 @@ SUnit *ScheduleDAGRRList::PickNodeToScheduleBottomUp() {
       // Issue copies, these can be expensive cross register class copies.
       SmallVector<SUnit*, 2> Copies;
       InsertCopiesAndMoveSuccs(LRDef, Reg, DestRC, RC, Copies);
-      LLVM_DEBUG(dbgs() << "    Adding an edge from SU #" << TrySU->NodeNum
-                        << " to SU #" << Copies.front()->NodeNum << "\n");
+      LLVM_DEBUG(dbgs() << "    Adding an edge from " << *TrySU << " to "
+                        << *Copies.front() << "\n");
       AddPredQueued(TrySU, SDep(Copies.front(), SDep::Artificial));
       NewDef = Copies.back();
     }
 
-    LLVM_DEBUG(dbgs() << "    Adding an edge from SU #" << NewDef->NodeNum
-                      << " to SU #" << TrySU->NodeNum << "\n");
+    LLVM_DEBUG(dbgs() << "    Adding an edge from " << *NewDef << " to "
+                      << *TrySU << "\n");
     LiveRegDefs[Reg] = NewDef;
     AddPredQueued(NewDef, SDep(TrySU, SDep::Artificial));
     TrySU->isAvailable = false;
@@ -2434,7 +2434,7 @@ static bool hasVRegCycleUse(const SUnit *SU) {
     if (Pred.isCtrl()) continue;  // ignore chain preds
     if (Pred.getSUnit()->isVRegCycle &&
         Pred.getSUnit()->getNode()->getOpcode() == ISD::CopyFromReg) {
-      LLVM_DEBUG(dbgs() << "  VReg cycle use: SU (" << SU->NodeNum << ")\n");
+      LLVM_DEBUG(dbgs() << "  VReg cycle use: " << *SU << "\n");
       return true;
     }
   }
@@ -2494,9 +2494,9 @@ static int BUCompareLatency(SUnit *left, SUnit *right, bool checkPref,
     int LDepth = left->getDepth() - LPenalty;
     int RDepth = right->getDepth() - RPenalty;
     if (LDepth != RDepth) {
-      LLVM_DEBUG(dbgs() << "  Comparing latency of SU (" << left->NodeNum
-                        << ") depth " << LDepth << " vs SU (" << right->NodeNum
-                        << ") depth " << RDepth << "\n");
+      LLVM_DEBUG(dbgs() << "  Comparing latency of " << *left << " depth "
+                        << LDepth << " vs " << *right << " depth " << RDepth
+                        << "\n");
       return LDepth < RDepth ? 1 : -1;
     }
     if (left->Latency != right->Latency)
@@ -2518,9 +2518,9 @@ static bool BURRSort(SUnit *left, SUnit *right, RegReductionPQBase *SPQ) {
       static const char *const PhysRegMsg[] = { " has no physreg",
                                                 " defines a physreg" };
       #endif
-      LLVM_DEBUG(dbgs() << "  SU (" << left->NodeNum << ") "
-                        << PhysRegMsg[LHasPhysReg] << " " << *right << " "
-                        << PhysRegMsg[RHasPhysReg] << "\n");
+      LLVM_DEBUG(dbgs() << "  " << *left << " " << PhysRegMsg[LHasPhysReg]
+                        << " " << *right << " " << PhysRegMsg[RHasPhysReg]
+                        << "\n");
       return LHasPhysReg < RHasPhysReg;
     }
   }
@@ -3000,8 +3000,7 @@ void RegReductionPQBase::PrescheduleNodesWithMultipleUses() {
     // Ok, the transformation is safe and the heuristics suggest it is
     // profitable. Update the graph.
     LLVM_DEBUG(
-        dbgs() << "    Prescheduling SU #" << SU.NodeNum << " next to PredSU #"
-               << PredSU->NodeNum
+        dbgs() << "    Prescheduling " << SU << " next to PredSU " << *PredSU
                << " to guide scheduling in the presence of multiple uses\n");
     for (unsigned i = 0; i != PredSU->Succs.size(); ++i) {
       SDep Edge = PredSU->Succs[i];
@@ -3091,9 +3090,8 @@ void RegReductionPQBase::AddPseudoTwoAddrDeps() {
              (isLiveOut && !hasOnlyLiveOutUses(SuccSU)) ||
              (!SU.isCommutable && SuccSU->isCommutable)) &&
             !scheduleDAG->IsReachable(SuccSU, &SU)) {
-          LLVM_DEBUG(dbgs()
-                     << "    Adding a pseudo-two-addr edge from SU #"
-                     << SU.NodeNum << " to SU #" << SuccSU->NodeNum << "\n");
+          LLVM_DEBUG(dbgs() << "    Adding a pseudo-two-addr edge from " << SU
+                            << " to " << *SuccSU << "\n");
           scheduleDAG->AddPredQueued(&SU, SDep(SuccSU, SDep::Artificial));
         }
       }
diff --git a/llvm/lib/CodeGen/VLIWMachineScheduler.cpp b/llvm/lib/CodeGen/VLIWMachineScheduler.cpp
index 605664c41359e..a9273e5d9eb59 100644
--- a/llvm/lib/CodeGen/VLIWMachineScheduler.cpp
+++ b/llvm/lib/CodeGen/VLIWMachineScheduler.cpp
@@ -29,6 +29,7 @@
 #include "llvm/CodeGen/TargetSubtargetInfo.h"
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/Debug.h"
+#include "llvm/Support/Format.h"
 #include "llvm/Support/raw_ostream.h"
 #include <algorithm>
 #include <cassert>
@@ -180,8 +181,7 @@ bool VLIWResourceModel::reserveResources(SUnit *SU, bool IsTop) {
 #ifndef NDEBUG
   LLVM_DEBUG(dbgs() << "Packet[" << TotalPackets << "]:\n");
   for (unsigned i = 0, e = Packet.size(); i != e; ++i) {
-    LLVM_DEBUG(dbgs() << "\t[" << i << "] SU(");
-    LLVM_DEBUG(dbgs() << Packet[i]->NodeNum << ")\t");
+    LLVM_DEBUG(dbgs() << "\t[" << i << "] " << *Packet[i] << "\t");
     LLVM_DEBUG(Packet[i]->getInstr()->dump());
   }
 #endif
@@ -528,9 +528,9 @@ void ConvergingVLIWScheduler::readyQueueVerboseDump(
     TempTracker.getMaxPressureDelta((*I)->getInstr(), RPDelta,
                                     DAG->getRegionCriticalPSets(),
                                     DAG->getRegPressure().MaxSetPressure);
-    std::stringstream dbgstr;
-    dbgstr << "SU(" << std::setw(3) << (*I)->NodeNum << ")";
-    dbgs() << dbgstr.str();
+    std::string SUStr;
+    raw_string_ostream(SUStr) << **I;
+    dbgs() << left_justify(SUStr, 7);
     SchedulingCost(Q, *I, Candidate, RPDelta, true);
     dbgs() << "\t";
     (*I)->getInstr()->dump();
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUIGroupLP.cpp b/llvm/lib/Target/AMDGPU/AMDGPUIGroupLP.cpp
index 2c316456d42c2..8ea07519116b9 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUIGroupLP.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPUIGroupLP.cpp
@@ -791,7 +791,7 @@ bool PipelineSolver::solveExact() {
   CurrCost += MissPenalty;
   advancePosition();
 
-  LLVM_DEBUG(dbgs() << "NOT Assigned (" << CurrSU.first->NodeNum << ")\n");
+  LLVM_DEBUG(dbgs() << "NOT Assigned " << *CurrSU.first << "\n");
 
   bool FinishedExploring = false;
   if (CurrCost < BestCost || BestCost == -1) {
diff --git a/llvm/lib/Target/AMDGPU/GCNILPSched.cpp b/llvm/lib/Target/AMDGPU/GCNILPSched.cpp
index 0fba4270a1626..44120ccf66049 100644
--- a/llvm/lib/Target/AMDGPU/GCNILPSched.cpp
+++ b/llvm/lib/Target/AMDGPU/GCNILPSched.cpp
@@ -148,9 +148,9 @@ static int BUCompareLatency(const SUnit *left, const SUnit *right) {
   int LDepth = left->getDepth();
   int RDepth = right->getDepth();
   if (LDepth != RDepth) {
-    LLVM_DEBUG(dbgs() << "  Comparing latency of SU (" << left->NodeNum
-                      << ") depth " << LDepth << " vs SU (" << right->NodeNum
-                      << ") depth " << RDepth << "\n");
+    LLVM_DEBUG(dbgs() << "  Comparing latency of " << *left << " depth "
+                      << LDepth << " vs " << *right << " depth " << RDepth
+                      << "\n");
     return LDepth < RDepth ? 1 : -1;
   }
   if (left->Latency != right->Latency)
@@ -323,9 +323,7 @@ GCNILPScheduler::schedule(ArrayRef<const SUnit*> BotRoots,
 
     LLVM_DEBUG(dbgs() << "\n=== Picking candidate\n"
                          "Ready queue:";
-               for (auto &C
-                    : AvailQueue) dbgs()
-               << ' ' << C.SU->NodeNum;
+               for (auto &C : AvailQueue) dbgs() << ' ' << *C.SU;
                dbgs() << '\n';);
 
     auto *C = pickCandidate();
diff --git a/llvm/lib/Target/AMDGPU/GCNMinRegStrategy.cpp b/llvm/lib/Target/AMDGPU/GCNMinRegStrategy.cpp
index 49307f964b952..e09db50d06634 100644
--- a/llvm/lib/Target/AMDGPU/GCNMinRegStrategy.cpp
+++ b/llvm/lib/Target/AMDGPU/GCNMinRegStrategy.cpp
@@ -241,9 +241,8 @@ GCNMinRegScheduler::schedule(ArrayRef<const SUnit*> TopRoots,
     LLVM_DEBUG(dbgs() << "\n=== Picking candidate, Step = " << StepNo
                       << "\n"
                          "Ready queue:";
-               for (auto &C
-                    : RQ) dbgs()
-               << ' ' << C.SU->NodeNum << "(P" << C.Priority << ')';
+               for (auto &C : RQ) dbgs()
+               << ' ' << *C.SU << "(P" << C.Priority << ')';
                dbgs() << '\n';);
 
     auto *C = pickCandidate();
diff --git a/llvm/test/CodeGen/AArch64/misched-detail-resource-booking-01.mir b/llvm/test/CodeGen/AArch64/misched-detail-resource-booking-01.mir
index 75166c6e9bbfb..196d6a87b8d32 100644
--- a/llvm/test/CodeGen/AArch64/misched-detail-resource-booking-01.mir
+++ b/llvm/test/CodeGen/AArch64/misched-detail-resource-booking-01.mir
@@ -396,7 +396,7 @@ body:             |
 # CHECK-NEXT:     selecting CortexA55UnitALU[0] available @3c
 # CHECK-NEXT:   Move SU(11) into Available Q
 # CHECK-NEXT: Queue BotQ.P:
-# CHECK-NEXT: Queue BotQ.A: 12 11
+# CHECK-NEXT: Queue BotQ.A: SU(12) SU(11)
 # CHECK-NEXT:   Cand SU(12) FIRST
 # CHECK-NEXT: Pick Bot Cand SU(12) FIRST
 # CHECK-NEXT: Scheduling SU(12) $q1 = COPY %12:fpr128
@@ -475,8 +475,8 @@ body:             |
 # CHECK-NEXT:     Instance 0 available @4c
 # CHECK-NEXT:     Instance 1 available @3c
 # CHECK-NEXT:     selecting CortexA55UnitALU[1] available @3c
-# CHECK-NEXT: Queue BotQ.P: 10
-# CHECK-NEXT: Queue BotQ.A: 11
+# CHECK-NEXT: Queue BotQ.P: SU(10)
+# CHECK-NEXT: Queue BotQ.A: SU(11)
 # CHECK-NEXT: Pick Bot Cand SU(11) ONLY1      [pre-RA]
 # CHECK-NEXT: Scheduling SU(11) $q0 = COPY %10:fpr128
 # CHECK-NEXT:   Ready @3c
@@ -581,7 +581,7 @@ body:             |
 # CHECK-NEXT:     selecting CortexA55UnitFPALU[0] available @7c
 # CHECK-N...
[truncated]

``````````

</details>


https://github.com/llvm/llvm-project/pull/229756


More information about the llvm-commits mailing list