[PATCH] D118824: CodeGen: Use asm register names in warning message

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 2 10:25:33 PST 2022


arsenm created this revision.
arsenm added reviewers: stuij, thakis, craig.topper, void, nickdesaulniers.
Herald added subscribers: kerbowa, hiraditya, tpr, jvesely.
arsenm requested review of this revision.
Herald added a subscriber: wdng.
Herald added a project: LLVM.

This was using the ugly tablegenerated register enum names, which are
really hideous for register tuples on AMDGPU. Use the prettier names
which are recognized by the asm parser.


https://reviews.llvm.org/D118824

Files:
  llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp
  llvm/test/CodeGen/AMDGPU/inline-asm-reserved-regs.ll


Index: llvm/test/CodeGen/AMDGPU/inline-asm-reserved-regs.ll
===================================================================
--- llvm/test/CodeGen/AMDGPU/inline-asm-reserved-regs.ll
+++ llvm/test/CodeGen/AMDGPU/inline-asm-reserved-regs.ll
@@ -1,6 +1,6 @@
 ; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 -verify-machineinstrs -o /dev/null 2>&1 %s | FileCheck -check-prefix=ERR %s
 
-; ERR: warning: inline asm clobber list contains reserved registers: VGPR42
+; ERR: warning: inline asm clobber list contains reserved registers: v42
 ; ERR: note: Reserved registers on the clobber list may not be preserved across the asm statement, and clobbering them may lead to undefined behaviour.
 define amdgpu_kernel void @clobber_occupancy_limited_vgpr() #0 {
 entry:
@@ -8,7 +8,7 @@
   ret void
 }
 
-; ERR: warning: inline asm clobber list contains reserved registers: VGPR42_VGPR43
+; ERR: warning: inline asm clobber list contains reserved registers: v[42:43]
 ; ERR: note: Reserved registers on the clobber list may not be preserved across the asm statement, and clobbering them may lead to undefined behaviour.
 define amdgpu_kernel void @clobber_occupancy_limited_vgpr64() #0 {
 entry:
@@ -16,7 +16,7 @@
   ret void
 }
 
-; ERR: warning: inline asm clobber list contains reserved registers: M0
+; ERR: warning: inline asm clobber list contains reserved registers: m0
 ; ERR: note: Reserved registers on the clobber list may not be preserved across the asm statement, and clobbering them may lead to undefined behaviour.
 define amdgpu_kernel void @clobber_m0() {
 entry:
@@ -24,7 +24,7 @@
   ret void
 }
 
-; ERR: warning: inline asm clobber list contains reserved registers: EXEC
+; ERR: warning: inline asm clobber list contains reserved registers: exec
 ; ERR: note: Reserved registers on the clobber list may not be preserved across the asm statement, and clobbering them may lead to undefined behaviour.
 define amdgpu_kernel void @clobber_exec() {
 entry:
@@ -32,7 +32,7 @@
   ret void
 }
 
-; ERR: warning: inline asm clobber list contains reserved registers: EXEC_LO
+; ERR: warning: inline asm clobber list contains reserved registers: exec_lo
 ; ERR: note: Reserved registers on the clobber list may not be preserved across the asm statement, and clobbering them may lead to undefined behaviour.
 define amdgpu_kernel void @clobber_exec_lo() {
 entry:
Index: llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp
===================================================================
--- llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp
+++ llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp
@@ -398,9 +398,9 @@
   if (!RestrRegs.empty()) {
     std::string Msg = "inline asm clobber list contains reserved registers: ";
     ListSeparator LS;
-    for (const Register &RR : RestrRegs) {
+    for (const Register RR : RestrRegs) {
       Msg += LS;
-      Msg += TRI->getName(RR);
+      Msg += TRI->getRegAsmName(RR);
     }
     const char *Note =
         "Reserved registers on the clobber list may not be "


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D118824.405342.patch
Type: text/x-patch
Size: 3026 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220202/e3c4aba1/attachment.bin>


More information about the llvm-commits mailing list