aboutsummaryrefslogtreecommitdiff
path: root/llvm/test/CodeGen/AMDGPU/liveout-implicit-def-subreg-redef-blender-verifier-error.mir
blob: 9eff5ac8a2a31472e97bf29c2d1ebeea3ee0a5cc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 2
# RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1031 -run-pass=register-coalescer -verify-coalescing -o - %s | FileCheck %s

# Make sure coalescing doesn't produce "no live segment at def" when
# there is a live out implicit_def with subranges.

# %1 will be coalesced into %0. %0 is a cross block implicit_def that
# cannot be deleted. The def of %0 in %bb.2 is a live out subregister
# def of the same register. We need to ensure that the resulting
# subrange for %0.sub0 includes the def in %bb.1

---
name: liveout_implicit_def_super_reg_redefine_sub0_implicit_def
tracksRegLiveness: true
body:             |
  ; CHECK-LABEL: name: liveout_implicit_def_super_reg_redefine_sub0_implicit_def
  ; CHECK: bb.0:
  ; CHECK-NEXT:   successors: %bb.2(0x40000000), %bb.1(0x40000000)
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT:   S_CBRANCH_SCC0 %bb.2, implicit undef $scc
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT: bb.1:
  ; CHECK-NEXT:   successors: %bb.3(0x80000000)
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT:   undef [[S_MOV_B32_:%[0-9]+]].sub0:sgpr_128 = S_MOV_B32 0
  ; CHECK-NEXT:   S_BRANCH %bb.3
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT: bb.2:
  ; CHECK-NEXT:   successors: %bb.3(0x80000000)
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT:   undef [[S_MOV_B32_:%[0-9]+]].sub0:sgpr_128 = IMPLICIT_DEF
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT: bb.3:
  ; CHECK-NEXT:   S_NOP 0, implicit [[S_MOV_B32_]]
  ; CHECK-NEXT:   S_NOP 0, implicit [[S_MOV_B32_]].sub0
  ; CHECK-NEXT:   S_ENDPGM 0
  bb.0:
    S_CBRANCH_SCC0 %bb.2, implicit undef $scc

  bb.1:
    %0:sgpr_128 = IMPLICIT_DEF
    %1:sgpr_32 = S_MOV_B32 0
    S_BRANCH %bb.3

  bb.2:
    undef %0.sub0:sgpr_128 = IMPLICIT_DEF
    %1:sgpr_32 = COPY %0.sub0

  bb.3:
    S_NOP 0, implicit %0
    S_NOP 0, implicit %1
    S_ENDPGM 0

...


# Redef of sub0 is a meaningful value.
---
name: liveout_implicit_def_redefine_sub0_undef_other
tracksRegLiveness: true
body:             |
  ; CHECK-LABEL: name: liveout_implicit_def_redefine_sub0_undef_other
  ; CHECK: bb.0:
  ; CHECK-NEXT:   successors: %bb.2(0x40000000), %bb.1(0x40000000)
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT:   S_CBRANCH_SCC0 %bb.2, implicit undef $scc
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT: bb.1:
  ; CHECK-NEXT:   successors: %bb.3(0x80000000)
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT:   undef [[S_MOV_B32_:%[0-9]+]].sub0:sgpr_128 = S_MOV_B32 0
  ; CHECK-NEXT:   S_BRANCH %bb.3
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT: bb.2:
  ; CHECK-NEXT:   successors: %bb.3(0x80000000)
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT:   undef [[S_MOV_B32_:%[0-9]+]].sub0:sgpr_128 = S_MOV_B32 9
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT: bb.3:
  ; CHECK-NEXT:   S_NOP 0, implicit [[S_MOV_B32_]]
  ; CHECK-NEXT:   S_NOP 0, implicit [[S_MOV_B32_]].sub0
  ; CHECK-NEXT:   S_ENDPGM 0
  bb.0:
    S_CBRANCH_SCC0 %bb.2, implicit undef $scc

  bb.1:
    %0:sgpr_128 = IMPLICIT_DEF
    %1:sgpr_32 = S_MOV_B32 0
    S_BRANCH %bb.3

  bb.2:
    undef %0.sub0:sgpr_128 = S_MOV_B32 9
    %1:sgpr_32 = COPY %0.sub0

  bb.3:
    S_NOP 0, implicit %0
    S_NOP 0, implicit %1
    S_ENDPGM 0

...

# The initial def of the register doesn't doesn't cover the redefined
# lanes. This had no error but was useful to compare against the
# failing cases.
---
name: only_redefine_undefined_lanes
tracksRegLiveness: true
body:             |
  ; CHECK-LABEL: name: only_redefine_undefined_lanes
  ; CHECK: bb.0:
  ; CHECK-NEXT:   successors: %bb.2(0x40000000), %bb.1(0x40000000)
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT:   S_CBRANCH_SCC0 %bb.2, implicit undef $scc
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT: bb.1:
  ; CHECK-NEXT:   successors: %bb.3(0x80000000)
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT:   S_NOP 0, implicit-def undef %0.sub1_sub2_sub3
  ; CHECK-NEXT:   [[V_MOV_B32_e32_:%[0-9]+]].sub0:vreg_128 = V_MOV_B32_e32 0, implicit $exec
  ; CHECK-NEXT:   S_BRANCH %bb.3
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT: bb.2:
  ; CHECK-NEXT:   successors: %bb.3(0x80000000)
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT:   undef [[V_MOV_B32_e32_:%[0-9]+]].sub0:vreg_128 = V_MOV_B32_e32 9, implicit $exec
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT: bb.3:
  ; CHECK-NEXT:   S_NOP 0, implicit [[V_MOV_B32_e32_]]
  ; CHECK-NEXT:   S_NOP 0, implicit [[V_MOV_B32_e32_]].sub0
  ; CHECK-NEXT:   S_ENDPGM 0
  bb.0:
    S_CBRANCH_SCC0 %bb.2, implicit undef $scc

  bb.1:
    S_NOP 0, implicit-def undef %0.sub1_sub2_sub3:vreg_128
    %1:vgpr_32 = V_MOV_B32_e32 0, implicit $exec
    S_BRANCH %bb.3

  bb.2:
    undef %0.sub0:vreg_128 = V_MOV_B32_e32 9, implicit $exec
    %1:vgpr_32 = COPY %0.sub0

  bb.3:
    S_NOP 0, implicit %0
    S_NOP 0, implicit %1
    S_ENDPGM 0

...