Skip to content

Commit 87117a2

Browse files
committed
MachineVerifier: Add tests which are incorrectly accepted
In the process of splitting out the liveness tracking, I ran into these cases which should have been caught. There are still missing errors for some cases in the entry block. https://reviews.llvm.org/D127104
1 parent 1255906 commit 87117a2

File tree

3 files changed

+64
-0
lines changed

3 files changed

+64
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# FIXME: This should fail the verifier
2+
# XFAIL: *
3+
# REQUIRES: amdgpu-registered-target
4+
# RUN: not --crash llc -o - -mtriple=amdgcn-amd-amdhsa -run-pass=none -verify-machineinstrs %s 2>&1 | FileCheck %s
5+
6+
# %1 is live out of %bb.1 through the loop edge, and therefore the kill flag is invalid.
7+
8+
# CHECK: *** Bad machine code: Virtual register killed in block, but needed live out. ***
9+
10+
---
11+
name: kill_flag_in_loop
12+
body: |
13+
bb.0:
14+
liveins: $sgpr0, $vgpr0_vgpr1
15+
successors: %bb.1(0x80000000)
16+
17+
%0:sreg_32 = COPY $sgpr0
18+
%1:sreg_32 = S_AND_B32 1, killed %0, implicit-def dead $scc
19+
20+
bb.1:
21+
successors: %bb.2(0x40000000), %bb.1(0x40000000)
22+
23+
S_CMP_EQ_I32 killed %1:sreg_32, 1, implicit-def $scc
24+
S_CBRANCH_SCC0 %bb.2, implicit $scc
25+
S_BRANCH %bb.1
26+
27+
bb.2:
28+
successors: %bb.3(0x80000000)
29+
30+
bb.3:
31+
S_ENDPGM 0
32+
33+
...
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# XFAIL: *
2+
# REQUIRES: amdgpu-registered-target
3+
# RUN: not --crash llc -o - -mtriple=amdgcn-amd-amdhsa -run-pass=none -verify-machineinstrs %s
4+
5+
# FIXME: This should catch the undefined use of %0
6+
7+
---
8+
name: undef_virtreg
9+
body: |
10+
bb.0:
11+
12+
S_ENDPGM 0, implicit %0:sreg_32
13+
14+
...
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# FIXME: This should fail the verifier
2+
# XFAIL: *
3+
# REQUIRES: amdgpu-registered-target
4+
# RUN: not --crash llc -o - -mtriple=amdgcn-amd-amdhsa -run-pass=none -verify-machineinstrs %s 2>&1 | FileCheck %s
5+
6+
# CHECK: *** Bad machine code: Virtual register defs don't dominate all uses. ***
7+
8+
---
9+
name: undef_virtreg
10+
body: |
11+
bb.0:
12+
13+
bb.1:
14+
%0:sreg_32 = S_AND_B32 1, %1:sreg_32, implicit-def dead $scc
15+
S_ENDPGM 0, implicit %1
16+
17+
...

0 commit comments

Comments
 (0)