[llvm] [MISched] Extract `isClustered()` method on SUnit (NFC) (PR #191700)
Tomer Shafir via llvm-commits
llvm-commits at lists.llvm.org
Sun Apr 12 05:04:48 PDT 2026
https://github.com/tomershafir created https://github.com/llvm/llvm-project/pull/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.
>From d50b844eaad959f6411ffb7f5fe7b347e5dc2a62 Mon Sep 17 00:00:00 2001
From: tomershafir <tomer.shafir8 at gmail.com>
Date: Sat, 11 Apr 2026 21:17:13 +0300
Subject: [PATCH] [MISched] Extract `isClustered()` method on SUnit (NFC)
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.
---
llvm/include/llvm/CodeGen/ScheduleDAG.h | 2 ++
llvm/lib/CodeGen/ScheduleDAG.cpp | 2 +-
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/llvm/include/llvm/CodeGen/ScheduleDAG.h b/llvm/include/llvm/CodeGen/ScheduleDAG.h
index aee1514581485..9ec7e417054d9 100644
--- a/llvm/include/llvm/CodeGen/ScheduleDAG.h
+++ b/llvm/include/llvm/CodeGen/ScheduleDAG.h
@@ -481,6 +481,8 @@ class TargetRegisterInfo;
/// edge occurs first.
LLVM_ABI void biasCriticalPath();
+ 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