[llvm] a96dbb9 - CodeGen: Use asm register names in warning message

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 2 11:20:18 PST 2022


Author: Matt Arsenault
Date: 2022-02-02T14:20:12-05:00
New Revision: a96dbb9035ea91adf369fcafffe49371806e971e

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

LOG: CodeGen: Use asm register names in warning message

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.

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp
index 5d0cadefdbf7a..c3f22996ab841 100644
--- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp
@@ -398,9 +398,9 @@ void AsmPrinter::emitInlineAsm(const MachineInstr *MI) const {
   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 "

diff  --git a/llvm/test/CodeGen/AMDGPU/inline-asm-reserved-regs.ll b/llvm/test/CodeGen/AMDGPU/inline-asm-reserved-regs.ll
index 9776e39d11403..9dc871439c64d 100644
--- a/llvm/test/CodeGen/AMDGPU/inline-asm-reserved-regs.ll
+++ b/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 @@ entry:
   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 @@ entry:
   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 @@ entry:
   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 @@ entry:
   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:


        


More information about the llvm-commits mailing list