1# RUN: llc -march=amdgcn -mcpu=gfx803 -run-pass simple-register-coalescing -verify-machineinstrs -o - %s | FileCheck --check-prefix=GCN %s
2#
3# This test gave "Use not jointly dominated by defs" when
4# removePartialRedundancy attempted to prune and then re-extend a subrange.
5#
6# GCN: {{^body}}
7
8---
9name:            _amdgpu_ps_main
10tracksRegLiveness: true
11body:             |
12  bb.0:
13    successors: %bb.1, %bb.2
14
15    %21:vgpr_32 = nofpexcept V_TRUNC_F32_e32 undef %22:vgpr_32, implicit $mode, implicit $exec
16    %23:vgpr_32 = nofpexcept V_CVT_U32_F32_e32 killed %21, implicit $mode, implicit $exec
17    %108:vgpr_32 = V_LSHRREV_B32_e32 4, killed %23, implicit $exec
18    undef %109.sub1:vreg_128 = COPY %108
19    %28:sreg_32_xm0_xexec = S_BUFFER_LOAD_DWORD_IMM undef %29:sgpr_128, 3044, 0, 0 :: (dereferenceable invariant load 4)
20    S_CMP_EQ_U32 killed %28, 0, implicit-def $scc
21    S_CBRANCH_SCC0 %bb.2, implicit killed $scc
22
23  bb.1:
24    %138:vreg_128 = COPY killed %109
25    S_BRANCH %bb.9
26
27  bb.2:
28    successors: %bb.3, %bb.4
29
30    S_CBRANCH_SCC0 %bb.4, implicit undef $scc
31
32  bb.3:
33    %136:vreg_128 = COPY killed %109
34    S_BRANCH %bb.5
35
36  bb.4:
37    %136:vreg_128 = COPY killed %109
38
39  bb.5:
40    successors: %bb.6, %bb.8
41
42    %110:vreg_128 = COPY killed %136
43    dead %32:sreg_32_xm0 = S_MOV_B32 0
44    %111:vreg_128 = COPY %110
45    %111.sub3:vreg_128 = COPY undef %32
46    S_CBRANCH_SCC1 %bb.8, implicit undef $scc
47    S_BRANCH %bb.6
48
49  bb.6:
50    %36:sreg_32_xm0_xexec = S_BUFFER_LOAD_DWORD_IMM undef %37:sgpr_128, 2708, 0, 0 :: (dereferenceable invariant load 4)
51    %39:vgpr_32 = nnan arcp contract reassoc nofpexcept V_MAD_F32 0, killed %110.sub1, 0, target-flags(amdgpu-gotprel32-lo) 0, 0, 0, 0, 0, implicit $mode, implicit $exec
52    %40:vgpr_32 = nofpexcept V_MAD_F32 0, %111.sub1, 0, target-flags(amdgpu-gotprel32-lo) 0, 0, 0, 0, 0, implicit $mode, implicit $exec
53    %41:vgpr_32 = nofpexcept V_MUL_F32_e64 0, 0, 0, killed %40, 1, 0, implicit $mode, implicit $exec
54    %43:vgpr_32 = nofpexcept V_MUL_F32_e32 0, %39, implicit $mode, implicit $exec
55    %44:vgpr_32 = COPY killed %43
56    %44:vgpr_32 = nofpexcept V_MAC_F32_e32 0, killed %41, %44, implicit $mode, implicit $exec
57    %47:vgpr_32 = V_MOV_B32_e32 2143289344, implicit $exec
58    %46:vgpr_32 = COPY killed %47
59    %46:vgpr_32 = nofpexcept V_MAC_F32_e32 0, killed %39, %46, implicit $mode, implicit $exec
60    undef %115.sub0:vreg_128 = COPY %46
61    %115.sub1:vreg_128 = COPY killed %46
62    %115.sub2:vreg_128 = COPY killed %44
63    %50:sreg_64_xexec = V_CMP_NE_U32_e64 0, killed %36, implicit $exec
64    dead %118:vgpr_32 = V_MOV_B32_e32 0, implicit $exec
65    %137:vreg_128 = IMPLICIT_DEF
66
67  bb.7:
68    successors: %bb.7, %bb.8
69
70    %119:vreg_128 = COPY killed %137
71    %121:vreg_128 = COPY killed %119
72    %121.sub3:vreg_128 = COPY undef %32
73    %56:vgpr_32 = nofpexcept V_ADD_F32_e32 %115.sub2, %121.sub2, implicit $mode, implicit $exec
74    %59:vgpr_32 = nofpexcept V_ADD_F32_e32 %115.sub1, %121.sub1, implicit $mode, implicit $exec
75    %62:vgpr_32 = nofpexcept V_ADD_F32_e32 %115.sub0, killed %121.sub0, implicit $mode, implicit $exec
76    undef %117.sub0:vreg_128 = COPY killed %62
77    %117.sub1:vreg_128 = COPY killed %59
78    %117.sub2:vreg_128 = COPY killed %56
79    %64:sreg_64 = S_AND_B64 $exec, %50, implicit-def dead $scc
80    $vcc = COPY killed %64
81    %137:vreg_128 = COPY killed %117
82    S_CBRANCH_VCCNZ %bb.7, implicit killed $vcc
83    S_BRANCH %bb.8
84
85  bb.8:
86    dead %66:sreg_32_xm0_xexec = S_BUFFER_LOAD_DWORD_IMM undef %67:sgpr_128, 2704, 0, 0 :: (dereferenceable invariant load 4)
87    %138:vreg_128 = COPY killed %111
88
89  bb.9:
90    %113:vreg_128 = COPY killed %138
91    S_CBRANCH_SCC1 %bb.18, implicit undef $scc
92    S_BRANCH %bb.10
93
94  bb.10:
95    S_CBRANCH_SCC1 %bb.12, implicit undef $scc
96    S_BRANCH %bb.11
97
98  bb.11:
99
100  bb.12:
101    successors: %bb.13, %bb.18
102
103    S_CBRANCH_SCC1 %bb.18, implicit undef $scc
104    S_BRANCH %bb.13
105
106  bb.13:
107    successors: %bb.14, %bb.17
108
109    S_CBRANCH_SCC1 %bb.17, implicit undef $scc
110    S_BRANCH %bb.14
111
112  bb.14:
113    S_CBRANCH_SCC1 %bb.16, implicit undef $scc
114    S_BRANCH %bb.15
115
116  bb.15:
117
118  bb.16:
119
120  bb.17:
121
122  bb.18:
123    S_CBRANCH_SCC1 %bb.26, implicit undef $scc
124    S_BRANCH %bb.19
125
126  bb.19:
127    S_CBRANCH_SCC1 %bb.26, implicit undef $scc
128    S_BRANCH %bb.20
129
130  bb.20:
131    S_CBRANCH_SCC1 %bb.25, implicit undef $scc
132    S_BRANCH %bb.21
133
134  bb.21:
135    successors: %bb.22, %bb.24
136
137    S_CBRANCH_SCC1 %bb.24, implicit undef $scc
138    S_BRANCH %bb.22
139
140  bb.22:
141    successors: %bb.23, %bb.24
142
143    S_CBRANCH_SCC1 %bb.24, implicit undef $scc
144    S_BRANCH %bb.23
145
146  bb.23:
147
148  bb.24:
149
150  bb.25:
151
152  bb.26:
153    S_CBRANCH_SCC1 %bb.33, implicit undef $scc
154    S_BRANCH %bb.27
155
156  bb.27:
157    S_CBRANCH_SCC1 %bb.33, implicit undef $scc
158    S_BRANCH %bb.28
159
160  bb.28:
161    dead %77:vgpr_32 = V_MOV_B32_e32 0, implicit $exec
162    %78:vgpr_32 = nnan arcp contract reassoc nofpexcept V_MAD_F32 0, killed %113.sub1, 0, target-flags(amdgpu-gotprel32-lo) 0, 0, 1065353216, 0, 0, implicit $mode, implicit $exec
163    dead %80:sreg_32_xm0 = S_MOV_B32 0
164    dead %82:vgpr_32 = nofpexcept V_MUL_F32_e32 killed %78, %78, implicit $mode, implicit $exec
165    dead %126:vgpr_32 = V_MOV_B32_e32 2143289344, implicit $exec
166    dead %125:vreg_128 = IMPLICIT_DEF
167    dead %91:sreg_32_xm0 = S_MOV_B32 2143289344
168    %96:sreg_64 = S_AND_B64 $exec, 0, implicit-def dead $scc
169    %139:vreg_128 = IMPLICIT_DEF
170
171  bb.29:
172    successors: %bb.30, %bb.31
173
174    dead %127:vreg_128 = COPY killed %139
175    S_CBRANCH_SCC0 %bb.31, implicit undef $scc
176
177  bb.30:
178    S_BRANCH %bb.32
179
180  bb.31:
181    successors: %bb.32, %bb.34
182
183    $vcc = COPY %96
184    S_CBRANCH_VCCNZ %bb.34, implicit killed $vcc
185    S_BRANCH %bb.32
186
187  bb.32:
188    dead %130:vreg_128 = IMPLICIT_DEF
189    dead %128:vreg_128 = COPY undef %130
190    %139:vreg_128 = IMPLICIT_DEF
191    S_BRANCH %bb.29
192
193  bb.33:
194    S_ENDPGM 0
195
196  bb.34:
197    S_ENDPGM 0
198
199...
200