[llvm] [MachineScheduler] Convert some of the debug prints into using LDBG. NFC (PR #161997)

Min-Yih Hsu via llvm-commits llvm-commits at lists.llvm.org
Sat Oct 4 23:18:44 PDT 2025


https://github.com/mshockwave created https://github.com/llvm/llvm-project/pull/161997

These lines are heavily skewed and hard to read. Using the new LDBG there instead.

NFC.

>From c97cfefb8ec5d059c0f1216304c988127fed266a Mon Sep 17 00:00:00 2001
From: Min Hsu <min at myhsu.dev>
Date: Sat, 4 Oct 2025 22:42:15 -0700
Subject: [PATCH] [MachineScheduler] Convert some of the debug prints into
 using LDBG. NFC

These lines are heavily skewed and hard to read. Using the new LDBG
there instead.

NFC.
---
 llvm/lib/CodeGen/MachineScheduler.cpp | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/llvm/lib/CodeGen/MachineScheduler.cpp b/llvm/lib/CodeGen/MachineScheduler.cpp
index 299bcc46e4bd2..22a59ec21b948 100644
--- a/llvm/lib/CodeGen/MachineScheduler.cpp
+++ b/llvm/lib/CodeGen/MachineScheduler.cpp
@@ -56,6 +56,7 @@
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/Compiler.h"
 #include "llvm/Support/Debug.h"
+#include "llvm/Support/DebugLog.h"
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/GraphWriter.h"
 #include "llvm/Support/raw_ostream.h"
@@ -3349,14 +3350,16 @@ void GenericSchedulerBase::setPolicy(CandPolicy &Policy, bool IsPostRA,
   if (CurrZone.getZoneCritResIdx() == OtherCritIdx)
     return;
 
-  LLVM_DEBUG(if (CurrZone.isResourceLimited()) {
-    dbgs() << "  " << CurrZone.Available.getName() << " ResourceLimited: "
+  if (CurrZone.isResourceLimited()) {
+    LDBG() << "  " << CurrZone.Available.getName() << " ResourceLimited: "
            << SchedModel->getResourceName(CurrZone.getZoneCritResIdx()) << "\n";
-  } if (OtherResLimited) dbgs()
-                 << "  RemainingLimit: "
-                 << SchedModel->getResourceName(OtherCritIdx) << "\n";
-             if (!CurrZone.isResourceLimited() && !OtherResLimited) dbgs()
-             << "  Latency limited both directions.\n");
+  }
+  if (OtherResLimited) {
+    LDBG() << "  RemainingLimit: " << SchedModel->getResourceName(OtherCritIdx)
+           << "\n";
+  }
+  if (!CurrZone.isResourceLimited() && !OtherResLimited)
+    LDBG() << "  Latency limited both directions.\n";
 
   if (CurrZone.isResourceLimited() && !Policy.ReduceResIdx)
     Policy.ReduceResIdx = CurrZone.getZoneCritResIdx();



More information about the llvm-commits mailing list