[llvm] [TableGen] Add `getName()` to error messages for better debugging (PR #149531)

Shaoce SUN via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 18 08:25:31 PDT 2025


https://github.com/sunshaoce created https://github.com/llvm/llvm-project/pull/149531

Including the name helps quickly locate the corresponding Instruction that caused the issue.

>From ad641f8e80e3a9894f6a9c614dc70b475a1a18f5 Mon Sep 17 00:00:00 2001
From: Shao-Ce SUN <sunshaoce at outlook.com>
Date: Fri, 18 Jul 2025 23:24:02 +0800
Subject: [PATCH] [TableGen] Add `getName()` to error messages for better
 debugging

Including the name helps quickly locate the corresponding Instruction that caused the issue.
---
 llvm/utils/TableGen/Common/CodeGenSchedule.cpp | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/llvm/utils/TableGen/Common/CodeGenSchedule.cpp b/llvm/utils/TableGen/Common/CodeGenSchedule.cpp
index 50346c29e8862..b07ea9e9d5caf 100644
--- a/llvm/utils/TableGen/Common/CodeGenSchedule.cpp
+++ b/llvm/utils/TableGen/Common/CodeGenSchedule.cpp
@@ -2114,7 +2114,8 @@ void CodeGenSchedModels::addWriteRes(const Record *ProcWriteResDef,
     const Record *WRDef = ProcWriteResDef->getValueAsDef("WriteType");
     if (!WRMap.try_emplace(WRDef, ProcWriteResDef).second)
       PrintFatalError(ProcWriteResDef->getLoc(),
-                      "WriteType already used in another WriteRes");
+                      "WriteType of " + WRDef->getName() +
+                          " already used in another WriteRes");
   }
 
   // Visit ProcResourceKinds referenced by the newly discovered WriteRes.
@@ -2148,7 +2149,8 @@ void CodeGenSchedModels::addReadAdvance(const Record *ProcReadAdvanceDef,
     const Record *RADef = ProcReadAdvanceDef->getValueAsDef("ReadType");
     if (!RAMap.try_emplace(RADef, ProcReadAdvanceDef).second)
       PrintFatalError(ProcReadAdvanceDef->getLoc(),
-                      "ReadType already used in another ReadAdvance");
+                      "ReadType of " + RADef->getName() +
+                          " already used in another ReadAdvance");
   }
 }
 



More information about the llvm-commits mailing list