[llvm] fe74f12 - [MISched] Extract `isClustered()` method on SUnit (NFC) (#191700)

via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 13 01:19:53 PDT 2026


Author: Tomer Shafir
Date: 2026-04-13T11:19:48+03:00
New Revision: fe74f12a9e71abb89f2732bb50df4a8271f9d1a1

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

LOG: [MISched] Extract `isClustered()` method on SUnit (NFC) (#191700)

This patch encapsulates the check for wether a `SUnit` is clustered,
rather than letting it scatter across call sites. Currently there is
only a single user, but more users can show up, and I think it provides
a cleaner API even for that single user.

Added: 
    

Modified: 
    llvm/include/llvm/CodeGen/ScheduleDAG.h
    llvm/lib/CodeGen/ScheduleDAG.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/CodeGen/ScheduleDAG.h b/llvm/include/llvm/CodeGen/ScheduleDAG.h
index aee1514581485..b84f8b99a06e2 100644
--- a/llvm/include/llvm/CodeGen/ScheduleDAG.h
+++ b/llvm/include/llvm/CodeGen/ScheduleDAG.h
@@ -481,6 +481,10 @@ class TargetRegisterInfo;
     /// edge occurs first.
     LLVM_ABI void biasCriticalPath();
 
+    LLVM_ABI bool isClustered() const {
+      return ParentClusterIdx != InvalidClusterId;
+    }
+
     LLVM_ABI void dumpAttributes() const;
 
   private:

diff  --git a/llvm/lib/CodeGen/ScheduleDAG.cpp b/llvm/lib/CodeGen/ScheduleDAG.cpp
index e630b80e33ab4..7008d93dd8aca 100644
--- a/llvm/lib/CodeGen/ScheduleDAG.cpp
+++ b/llvm/lib/CodeGen/ScheduleDAG.cpp
@@ -365,7 +365,7 @@ LLVM_DUMP_METHOD void ScheduleDAG::dumpNodeName(const SUnit &SU) const {
 LLVM_DUMP_METHOD void ScheduleDAG::dumpNodeAll(const SUnit &SU) const {
   dumpNode(SU);
   SU.dumpAttributes();
-  if (SU.ParentClusterIdx != InvalidClusterId)
+  if (SU.isClustered())
     dbgs() << "  Parent Cluster Index: " << SU.ParentClusterIdx << '\n';
 
   if (SU.Preds.size() > 0) {


        


More information about the llvm-commits mailing list