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

via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 18 09:44:19 PDT 2025


Author: Shaoce SUN
Date: 2025-07-19T00:44:16+08:00
New Revision: 0c75e093813c86a1c99b75d2a46f56db7ab516dd

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

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

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

Added: 
    

Modified: 
    llvm/utils/TableGen/Common/CodeGenSchedule.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/utils/TableGen/Common/CodeGenSchedule.cpp b/llvm/utils/TableGen/Common/CodeGenSchedule.cpp
index 50346c29e88626..b07ea9e9d5caf0 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