[llvm] [AMDGPU] Add MachineVerifer check to detect illegal copies from VGPR to SGPR (PR #105494)

Aditi Medhane via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 27 03:01:44 PDT 2024


================
@@ -0,0 +1,29 @@
+# RUN: not --crash llc -march=amdgcn -mcpu=gfx1200 -run-pass=machineverifier %s 2>&1 | FileCheck -check-prefix=ERR %s
+
+---
+name: fix-illegal-copies
+tracksRegLiveness: true
+machineFunctionInfo:
+  isEntryFunction: true
+body:             |
+  bb.0:
+    %0:vgpr_32 = IMPLICIT_DEF
+    %0:vgpr_32 = IMPLICIT_DEF ; Break SSA format
+    %1:vgpr_32 = IMPLICIT_DEF
+    %2:sgpr_32 = IMPLICIT_DEF
+    %3:sgpr_32 = IMPLICIT_DEF
+
+    ; ERR: *** Bad machine code: illegal copy from VGPR to SGPR ***
+    ; ERR: instruction: %4:sgpr_32 = COPY %0:vgpr_32
+    %4:sgpr_32 = COPY %0:vgpr_32
+
+    ; ERR: *** Bad machine code: illegal copy from VGPR to SGPR ***
+    ; ERR: instruction: $sgpr0 = COPY %0:vgpr_32
+    $sgpr0 = COPY %0:vgpr_32
+    
+    ; ERR: *** Bad machine code: illegal copy from VGPR to SGPR ***
+    ; ERR: instruction: $sgpr1 = COPY $vgpr0
+    $sgpr1 = COPY $vgpr0
+
----------------
AditiRM wrote:

Updated the testcase with AGPR and tuple cases

https://github.com/llvm/llvm-project/pull/105494


More information about the llvm-commits mailing list