[llvm] [MCA] Use LLVM_DEBUG instead of direct NDEBUG check (NFC) (PR #189389)

Tomer Shafir via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 30 07:12:05 PDT 2026


https://github.com/tomershafir updated https://github.com/llvm/llvm-project/pull/189389

>From 07085afb662bd3a92c03cc8ad1d5aefab42790f1 Mon Sep 17 00:00:00 2001
From: tomershafir <tomer.shafir8 at gmail.com>
Date: Mon, 30 Mar 2026 17:11:32 +0300
Subject: [PATCH] [MCA] Use LLVM_DEBUG instead of direct NDEBUG check (NFC)

Use the conventional multiline `LLVM_DEBUG` macro for a debug-printing-only code block, instead of unwrapping a direct `NDEBUG` check.
---
 llvm/lib/MCA/Support.cpp | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/llvm/lib/MCA/Support.cpp b/llvm/lib/MCA/Support.cpp
index f8b8a2d129c1c..1f1f2ab8d2c36 100644
--- a/llvm/lib/MCA/Support.cpp
+++ b/llvm/lib/MCA/Support.cpp
@@ -68,16 +68,14 @@ void computeProcResourceMasks(const MCSchedModel &SM,
     ProcResourceID++;
   }
 
-#ifndef NDEBUG
-  LLVM_DEBUG(dbgs() << "\nProcessor resource masks:"
-                    << "\n");
-  for (unsigned I = 0, E = SM.getNumProcResourceKinds(); I < E; ++I) {
-    const MCProcResourceDesc &Desc = *SM.getProcResource(I);
-    LLVM_DEBUG(dbgs() << '[' << format_decimal(I,2) << "] " << " - "
-                      << format_hex(Masks[I],16) << " - "
-                      << Desc.Name << '\n');
-  }
-#endif
+  LLVM_DEBUG({
+    dbgs() << "\nProcessor resource masks:\n";
+    for (unsigned I = 0, E = SM.getNumProcResourceKinds(); I < E; ++I) {
+      const MCProcResourceDesc &Desc = *SM.getProcResource(I);
+      dbgs() << '[' << format_decimal(I, 2) << "] " << " - "
+             << format_hex(Masks[I], 16) << " - " << Desc.Name << '\n';
+    }
+  });
 }
 
 double computeBlockRThroughput(const MCSchedModel &SM, unsigned DispatchWidth,



More information about the llvm-commits mailing list