[PATCH] D127104: MachineVerifier: Add tests which are incorrectly accepted

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 1 05:59:11 PDT 2023


arsenm updated this revision to Diff 555348.
arsenm added a comment.

Just going to push these as xfailed to get off of phabricator, need to redo the new verifier checks


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D127104/new/

https://reviews.llvm.org/D127104

Files:
  llvm/test/MachineVerifier/register-killed-inside-loop.mir
  llvm/test/MachineVerifier/undef-virt-reg-entry-block.mir
  llvm/test/MachineVerifier/undef-virt-reg-nonentry-block.mir


Index: llvm/test/MachineVerifier/undef-virt-reg-nonentry-block.mir
===================================================================
--- /dev/null
+++ llvm/test/MachineVerifier/undef-virt-reg-nonentry-block.mir
@@ -0,0 +1,17 @@
+# FIXME: This should fail the verifier
+# XFAIL: *
+# REQUIRES: amdgpu-registered-target
+# RUN: not --crash llc -o - -mtriple=amdgcn-amd-amdhsa -run-pass=none -verify-machineinstrs %s 2>&1 | FileCheck %s
+
+# CHECK: *** Bad machine code: Virtual register defs don't dominate all uses. ***
+
+---
+name:            undef_virtreg
+body:             |
+  bb.0:
+
+  bb.1:
+    %0:sreg_32 = S_AND_B32 1, %1:sreg_32, implicit-def dead $scc
+    S_ENDPGM 0, implicit %1
+
+...
Index: llvm/test/MachineVerifier/undef-virt-reg-entry-block.mir
===================================================================
--- /dev/null
+++ llvm/test/MachineVerifier/undef-virt-reg-entry-block.mir
@@ -0,0 +1,14 @@
+# XFAIL: *
+# REQUIRES: amdgpu-registered-target
+# RUN: not --crash llc -o - -mtriple=amdgcn-amd-amdhsa -run-pass=none -verify-machineinstrs %s
+
+ # FIXME: This should catch the undefined use of %0
+
+---
+name:            undef_virtreg
+body:             |
+  bb.0:
+
+    S_ENDPGM 0, implicit %0:sreg_32
+
+...
Index: llvm/test/MachineVerifier/register-killed-inside-loop.mir
===================================================================
--- /dev/null
+++ llvm/test/MachineVerifier/register-killed-inside-loop.mir
@@ -0,0 +1,33 @@
+# FIXME: This should fail the verifier
+# XFAIL: *
+# REQUIRES: amdgpu-registered-target
+# RUN: not --crash llc -o - -mtriple=amdgcn-amd-amdhsa -run-pass=none -verify-machineinstrs %s 2>&1 | FileCheck %s
+
+# %1 is live out of %bb.1 through the loop edge, and therefore the kill flag is invalid.
+
+# CHECK: *** Bad machine code: Virtual register killed in block, but needed live out. ***
+
+---
+name:            kill_flag_in_loop
+body:             |
+  bb.0:
+    liveins: $sgpr0, $vgpr0_vgpr1
+    successors: %bb.1(0x80000000)
+
+    %0:sreg_32 = COPY $sgpr0
+    %1:sreg_32 = S_AND_B32 1, killed %0, implicit-def dead $scc
+
+  bb.1:
+    successors: %bb.2(0x40000000), %bb.1(0x40000000)
+
+    S_CMP_EQ_I32 killed %1:sreg_32, 1, implicit-def $scc
+    S_CBRANCH_SCC0 %bb.2, implicit $scc
+    S_BRANCH %bb.1
+
+  bb.2:
+    successors: %bb.3(0x80000000)
+
+  bb.3:
+    S_ENDPGM 0
+
+...


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D127104.555348.patch
Type: text/x-patch
Size: 2366 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230901/ad337115/attachment.bin>


More information about the llvm-commits mailing list