1# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2# RUN: llc -march=amdgcn -mcpu=fiji -run-pass=regbankselect -regbankselect-fast -verify-machineinstrs -o - %s | FileCheck -check-prefix=FAST %s
3# RUN: llc -march=amdgcn -mcpu=fiji -run-pass=regbankselect -regbankselect-greedy -verify-machineinstrs -o - %s | FileCheck -check-prefix=GREEDY %s
4
5---
6name: phi_s1_scc_scc_sbranch
7legalized: true
8tracksRegLiveness: true
9
10body: |
11  ; FAST-LABEL: name: phi_s1_scc_scc_sbranch
12  ; FAST: bb.0:
13  ; FAST:   successors: %bb.1(0x40000000), %bb.2(0x40000000)
14  ; FAST:   liveins: $sgpr0, $sgpr1, $sgpr2
15  ; FAST:   [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
16  ; FAST:   [[COPY1:%[0-9]+]]:sgpr(s32) = COPY $sgpr1
17  ; FAST:   [[COPY2:%[0-9]+]]:sgpr(s32) = COPY $sgpr2
18  ; FAST:   [[C:%[0-9]+]]:sgpr(s32) = G_CONSTANT i32 0
19  ; FAST:   [[ICMP:%[0-9]+]]:sgpr(s32) = G_ICMP intpred(eq), [[COPY]](s32), [[C]]
20  ; FAST:   [[TRUNC:%[0-9]+]]:sgpr(s1) = G_TRUNC [[ICMP]](s32)
21  ; FAST:   [[ICMP1:%[0-9]+]]:sgpr(s32) = G_ICMP intpred(eq), [[COPY2]](s32), [[C]]
22  ; FAST:   [[TRUNC1:%[0-9]+]]:sgpr(s1) = G_TRUNC [[ICMP1]](s32)
23  ; FAST:   [[ZEXT:%[0-9]+]]:sgpr(s32) = G_ZEXT [[TRUNC1]](s1)
24  ; FAST:   [[ANYEXT:%[0-9]+]]:sgpr(s32) = G_ANYEXT [[TRUNC]](s1)
25  ; FAST:   G_BRCOND [[ZEXT]](s32), %bb.1
26  ; FAST:   G_BR %bb.2
27  ; FAST: bb.1:
28  ; FAST:   successors: %bb.2(0x80000000)
29  ; FAST:   [[ICMP2:%[0-9]+]]:sgpr(s32) = G_ICMP intpred(eq), [[COPY1]](s32), [[C]]
30  ; FAST:   [[TRUNC2:%[0-9]+]]:sgpr(s1) = G_TRUNC [[ICMP2]](s32)
31  ; FAST:   [[ANYEXT1:%[0-9]+]]:sgpr(s32) = G_ANYEXT [[TRUNC2]](s1)
32  ; FAST:   G_BR %bb.2
33  ; FAST: bb.2:
34  ; FAST:   [[PHI:%[0-9]+]]:sgpr(s32) = G_PHI [[ANYEXT]](s32), %bb.0, [[ANYEXT1]](s32), %bb.1
35  ; FAST:   [[TRUNC3:%[0-9]+]]:sgpr(s1) = G_TRUNC [[PHI]](s32)
36  ; FAST:   [[ZEXT1:%[0-9]+]]:sgpr(s32) = G_ZEXT [[TRUNC3]](s1)
37  ; FAST:   [[SELECT:%[0-9]+]]:sgpr(s32) = G_SELECT [[ZEXT1]](s32), [[C]], [[COPY]]
38  ; FAST:   S_SETPC_B64 undef $sgpr30_sgpr31, implicit [[SELECT]](s32)
39  ; GREEDY-LABEL: name: phi_s1_scc_scc_sbranch
40  ; GREEDY: bb.0:
41  ; GREEDY:   successors: %bb.1(0x40000000), %bb.2(0x40000000)
42  ; GREEDY:   liveins: $sgpr0, $sgpr1, $sgpr2
43  ; GREEDY:   [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
44  ; GREEDY:   [[COPY1:%[0-9]+]]:sgpr(s32) = COPY $sgpr1
45  ; GREEDY:   [[COPY2:%[0-9]+]]:sgpr(s32) = COPY $sgpr2
46  ; GREEDY:   [[C:%[0-9]+]]:sgpr(s32) = G_CONSTANT i32 0
47  ; GREEDY:   [[ICMP:%[0-9]+]]:sgpr(s32) = G_ICMP intpred(eq), [[COPY]](s32), [[C]]
48  ; GREEDY:   [[TRUNC:%[0-9]+]]:sgpr(s1) = G_TRUNC [[ICMP]](s32)
49  ; GREEDY:   [[ICMP1:%[0-9]+]]:sgpr(s32) = G_ICMP intpred(eq), [[COPY2]](s32), [[C]]
50  ; GREEDY:   [[TRUNC1:%[0-9]+]]:sgpr(s1) = G_TRUNC [[ICMP1]](s32)
51  ; GREEDY:   [[ZEXT:%[0-9]+]]:sgpr(s32) = G_ZEXT [[TRUNC1]](s1)
52  ; GREEDY:   [[ANYEXT:%[0-9]+]]:sgpr(s32) = G_ANYEXT [[TRUNC]](s1)
53  ; GREEDY:   G_BRCOND [[ZEXT]](s32), %bb.1
54  ; GREEDY:   G_BR %bb.2
55  ; GREEDY: bb.1:
56  ; GREEDY:   successors: %bb.2(0x80000000)
57  ; GREEDY:   [[ICMP2:%[0-9]+]]:sgpr(s32) = G_ICMP intpred(eq), [[COPY1]](s32), [[C]]
58  ; GREEDY:   [[TRUNC2:%[0-9]+]]:sgpr(s1) = G_TRUNC [[ICMP2]](s32)
59  ; GREEDY:   [[ANYEXT1:%[0-9]+]]:sgpr(s32) = G_ANYEXT [[TRUNC2]](s1)
60  ; GREEDY:   G_BR %bb.2
61  ; GREEDY: bb.2:
62  ; GREEDY:   [[PHI:%[0-9]+]]:sgpr(s32) = G_PHI [[ANYEXT]](s32), %bb.0, [[ANYEXT1]](s32), %bb.1
63  ; GREEDY:   [[TRUNC3:%[0-9]+]]:sgpr(s1) = G_TRUNC [[PHI]](s32)
64  ; GREEDY:   [[ZEXT1:%[0-9]+]]:sgpr(s32) = G_ZEXT [[TRUNC3]](s1)
65  ; GREEDY:   [[SELECT:%[0-9]+]]:sgpr(s32) = G_SELECT [[ZEXT1]](s32), [[C]], [[COPY]]
66  ; GREEDY:   S_SETPC_B64 undef $sgpr30_sgpr31, implicit [[SELECT]](s32)
67  bb.0:
68    successors: %bb.1, %bb.2
69    liveins: $sgpr0, $sgpr1, $sgpr2
70
71    %0:_(s32) = COPY $sgpr0
72    %1:_(s32) = COPY $sgpr1
73    %2:_(s32) = COPY $sgpr2
74    %3:_(s32) = G_CONSTANT i32 0
75    %4:_(s1) = G_ICMP intpred(eq), %0, %3
76    %5:_(s1) = G_ICMP intpred(eq), %2, %3
77    G_BRCOND %5, %bb.1
78    G_BR %bb.2
79
80  bb.1:
81    successors: %bb.2
82
83    %6:_(s1) = G_ICMP intpred(eq), %1, %3
84    G_BR %bb.2
85
86  bb.2:
87    %7:_(s1) = G_PHI %4, %bb.0, %6, %bb.1
88    %8:_(s32) = G_SELECT %7, %3, %0
89    S_SETPC_B64 undef $sgpr30_sgpr31, implicit %8
90
91...
92
93---
94name: phi_s1_scc_scc_scc_sbranch
95legalized: true
96tracksRegLiveness: true
97
98body: |
99  ; FAST-LABEL: name: phi_s1_scc_scc_scc_sbranch
100  ; FAST: bb.0:
101  ; FAST:   successors: %bb.1(0x40000000), %bb.3(0x40000000)
102  ; FAST:   liveins: $sgpr0, $sgpr1, $sgpr2, $sgpr3
103  ; FAST:   [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
104  ; FAST:   [[COPY1:%[0-9]+]]:sgpr(s32) = COPY $sgpr1
105  ; FAST:   [[COPY2:%[0-9]+]]:sgpr(s32) = COPY $sgpr2
106  ; FAST:   [[COPY3:%[0-9]+]]:sgpr(s32) = COPY $sgpr3
107  ; FAST:   [[C:%[0-9]+]]:sgpr(s32) = G_CONSTANT i32 0
108  ; FAST:   [[ICMP:%[0-9]+]]:sgpr(s32) = G_ICMP intpred(eq), [[COPY]](s32), [[COPY3]]
109  ; FAST:   [[TRUNC:%[0-9]+]]:sgpr(s1) = G_TRUNC [[ICMP]](s32)
110  ; FAST:   [[ICMP1:%[0-9]+]]:sgpr(s32) = G_ICMP intpred(eq), [[COPY2]](s32), [[COPY3]]
111  ; FAST:   [[TRUNC1:%[0-9]+]]:sgpr(s1) = G_TRUNC [[ICMP1]](s32)
112  ; FAST:   [[ZEXT:%[0-9]+]]:sgpr(s32) = G_ZEXT [[TRUNC1]](s1)
113  ; FAST:   [[ANYEXT:%[0-9]+]]:sgpr(s32) = G_ANYEXT [[TRUNC]](s1)
114  ; FAST:   G_BRCOND [[ZEXT]](s32), %bb.3
115  ; FAST:   G_BR %bb.1
116  ; FAST: bb.1:
117  ; FAST:   successors: %bb.2(0x40000000), %bb.3(0x40000000)
118  ; FAST:   [[C1:%[0-9]+]]:sgpr(s32) = G_CONSTANT i32 99
119  ; FAST:   [[C2:%[0-9]+]]:sgpr(s32) = G_CONSTANT i32 888
120  ; FAST:   [[ICMP2:%[0-9]+]]:sgpr(s32) = G_ICMP intpred(eq), [[COPY1]](s32), [[C1]]
121  ; FAST:   [[TRUNC2:%[0-9]+]]:sgpr(s1) = G_TRUNC [[ICMP2]](s32)
122  ; FAST:   [[ICMP3:%[0-9]+]]:sgpr(s32) = G_ICMP intpred(eq), [[COPY1]](s32), [[C2]]
123  ; FAST:   [[TRUNC3:%[0-9]+]]:sgpr(s1) = G_TRUNC [[ICMP3]](s32)
124  ; FAST:   [[ZEXT1:%[0-9]+]]:sgpr(s32) = G_ZEXT [[TRUNC3]](s1)
125  ; FAST:   [[ANYEXT1:%[0-9]+]]:sgpr(s32) = G_ANYEXT [[TRUNC2]](s1)
126  ; FAST:   G_BRCOND [[ZEXT1]](s32), %bb.3
127  ; FAST:   G_BR %bb.2
128  ; FAST: bb.2:
129  ; FAST:   successors: %bb.3(0x80000000)
130  ; FAST:   [[C3:%[0-9]+]]:sgpr(s32) = G_CONSTANT i32 123
131  ; FAST:   [[ICMP4:%[0-9]+]]:sgpr(s32) = G_ICMP intpred(eq), [[COPY2]](s32), [[C3]]
132  ; FAST:   [[TRUNC4:%[0-9]+]]:sgpr(s1) = G_TRUNC [[ICMP4]](s32)
133  ; FAST:   [[ANYEXT2:%[0-9]+]]:sgpr(s32) = G_ANYEXT [[TRUNC4]](s1)
134  ; FAST:   G_BR %bb.3
135  ; FAST: bb.3:
136  ; FAST:   [[PHI:%[0-9]+]]:sgpr(s32) = G_PHI [[ANYEXT]](s32), %bb.0, [[ANYEXT1]](s32), %bb.1, [[ANYEXT2]](s32), %bb.2
137  ; FAST:   [[TRUNC5:%[0-9]+]]:sgpr(s1) = G_TRUNC [[PHI]](s32)
138  ; FAST:   [[ZEXT2:%[0-9]+]]:sgpr(s32) = G_ZEXT [[TRUNC5]](s1)
139  ; FAST:   [[SELECT:%[0-9]+]]:sgpr(s32) = G_SELECT [[ZEXT2]](s32), [[COPY]], [[COPY1]]
140  ; FAST:   S_SETPC_B64 undef $sgpr30_sgpr31, implicit [[SELECT]](s32)
141  ; GREEDY-LABEL: name: phi_s1_scc_scc_scc_sbranch
142  ; GREEDY: bb.0:
143  ; GREEDY:   successors: %bb.1(0x40000000), %bb.3(0x40000000)
144  ; GREEDY:   liveins: $sgpr0, $sgpr1, $sgpr2, $sgpr3
145  ; GREEDY:   [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
146  ; GREEDY:   [[COPY1:%[0-9]+]]:sgpr(s32) = COPY $sgpr1
147  ; GREEDY:   [[COPY2:%[0-9]+]]:sgpr(s32) = COPY $sgpr2
148  ; GREEDY:   [[COPY3:%[0-9]+]]:sgpr(s32) = COPY $sgpr3
149  ; GREEDY:   [[C:%[0-9]+]]:sgpr(s32) = G_CONSTANT i32 0
150  ; GREEDY:   [[ICMP:%[0-9]+]]:sgpr(s32) = G_ICMP intpred(eq), [[COPY]](s32), [[COPY3]]
151  ; GREEDY:   [[TRUNC:%[0-9]+]]:sgpr(s1) = G_TRUNC [[ICMP]](s32)
152  ; GREEDY:   [[ICMP1:%[0-9]+]]:sgpr(s32) = G_ICMP intpred(eq), [[COPY2]](s32), [[COPY3]]
153  ; GREEDY:   [[TRUNC1:%[0-9]+]]:sgpr(s1) = G_TRUNC [[ICMP1]](s32)
154  ; GREEDY:   [[ZEXT:%[0-9]+]]:sgpr(s32) = G_ZEXT [[TRUNC1]](s1)
155  ; GREEDY:   [[ANYEXT:%[0-9]+]]:sgpr(s32) = G_ANYEXT [[TRUNC]](s1)
156  ; GREEDY:   G_BRCOND [[ZEXT]](s32), %bb.3
157  ; GREEDY:   G_BR %bb.1
158  ; GREEDY: bb.1:
159  ; GREEDY:   successors: %bb.2(0x40000000), %bb.3(0x40000000)
160  ; GREEDY:   [[C1:%[0-9]+]]:sgpr(s32) = G_CONSTANT i32 99
161  ; GREEDY:   [[C2:%[0-9]+]]:sgpr(s32) = G_CONSTANT i32 888
162  ; GREEDY:   [[ICMP2:%[0-9]+]]:sgpr(s32) = G_ICMP intpred(eq), [[COPY1]](s32), [[C1]]
163  ; GREEDY:   [[TRUNC2:%[0-9]+]]:sgpr(s1) = G_TRUNC [[ICMP2]](s32)
164  ; GREEDY:   [[ICMP3:%[0-9]+]]:sgpr(s32) = G_ICMP intpred(eq), [[COPY1]](s32), [[C2]]
165  ; GREEDY:   [[TRUNC3:%[0-9]+]]:sgpr(s1) = G_TRUNC [[ICMP3]](s32)
166  ; GREEDY:   [[ZEXT1:%[0-9]+]]:sgpr(s32) = G_ZEXT [[TRUNC3]](s1)
167  ; GREEDY:   [[ANYEXT1:%[0-9]+]]:sgpr(s32) = G_ANYEXT [[TRUNC2]](s1)
168  ; GREEDY:   G_BRCOND [[ZEXT1]](s32), %bb.3
169  ; GREEDY:   G_BR %bb.2
170  ; GREEDY: bb.2:
171  ; GREEDY:   successors: %bb.3(0x80000000)
172  ; GREEDY:   [[C3:%[0-9]+]]:sgpr(s32) = G_CONSTANT i32 123
173  ; GREEDY:   [[ICMP4:%[0-9]+]]:sgpr(s32) = G_ICMP intpred(eq), [[COPY2]](s32), [[C3]]
174  ; GREEDY:   [[TRUNC4:%[0-9]+]]:sgpr(s1) = G_TRUNC [[ICMP4]](s32)
175  ; GREEDY:   [[ANYEXT2:%[0-9]+]]:sgpr(s32) = G_ANYEXT [[TRUNC4]](s1)
176  ; GREEDY:   G_BR %bb.3
177  ; GREEDY: bb.3:
178  ; GREEDY:   [[PHI:%[0-9]+]]:sgpr(s32) = G_PHI [[ANYEXT]](s32), %bb.0, [[ANYEXT1]](s32), %bb.1, [[ANYEXT2]](s32), %bb.2
179  ; GREEDY:   [[TRUNC5:%[0-9]+]]:sgpr(s1) = G_TRUNC [[PHI]](s32)
180  ; GREEDY:   [[ZEXT2:%[0-9]+]]:sgpr(s32) = G_ZEXT [[TRUNC5]](s1)
181  ; GREEDY:   [[SELECT:%[0-9]+]]:sgpr(s32) = G_SELECT [[ZEXT2]](s32), [[COPY]], [[COPY1]]
182  ; GREEDY:   S_SETPC_B64 undef $sgpr30_sgpr31, implicit [[SELECT]](s32)
183  bb.0:
184    successors: %bb.1, %bb.3
185    liveins: $sgpr0, $sgpr1, $sgpr2, $sgpr3
186
187    %0:_(s32) = COPY $sgpr0
188    %1:_(s32) = COPY $sgpr1
189    %2:_(s32) = COPY $sgpr2
190    %3:_(s32) = COPY $sgpr3
191    %4:_(s32) = G_CONSTANT i32 0
192    %5:_(s1) = G_ICMP intpred(eq), %0, %3
193    %6:_(s1) = G_ICMP intpred(eq), %2, %3
194    G_BRCOND %6, %bb.3
195    G_BR %bb.1
196
197  bb.1:
198    successors: %bb.2, %bb.3
199
200    %7:_(s32) = G_CONSTANT i32 99
201    %8:_(s32) = G_CONSTANT i32 888
202    %9:_(s1) = G_ICMP intpred(eq), %1, %7
203    %10:_(s1) = G_ICMP intpred(eq), %1, %8
204    G_BRCOND %10, %bb.3
205    G_BR %bb.2
206
207  bb.2:
208    successors: %bb.3
209
210    %11:_(s32) = G_CONSTANT i32 123
211    %12:_(s1) = G_ICMP intpred(eq), %2, %11
212    G_BR %bb.3
213
214  bb.3:
215    %13:_(s1) = G_PHI %5, %bb.0, %9, %bb.1, %12, %bb.2
216    %14:_(s32) = G_SELECT %13, %0, %1
217    S_SETPC_B64 undef $sgpr30_sgpr31, implicit %14
218
219...
220
221---
222name: phi_s1_scc_vcc_sbranch
223legalized: true
224tracksRegLiveness: true
225
226body: |
227  ; FAST-LABEL: name: phi_s1_scc_vcc_sbranch
228  ; FAST: bb.0:
229  ; FAST:   successors: %bb.1(0x40000000), %bb.2(0x40000000)
230  ; FAST:   liveins: $sgpr0, $sgpr1, $vgpr0
231  ; FAST:   [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
232  ; FAST:   [[COPY1:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
233  ; FAST:   [[COPY2:%[0-9]+]]:sgpr(s32) = COPY $sgpr1
234  ; FAST:   [[C:%[0-9]+]]:sgpr(s32) = G_CONSTANT i32 0
235  ; FAST:   [[ICMP:%[0-9]+]]:sgpr(s32) = G_ICMP intpred(eq), [[COPY]](s32), [[C]]
236  ; FAST:   [[TRUNC:%[0-9]+]]:sgpr(s1) = G_TRUNC [[ICMP]](s32)
237  ; FAST:   [[ICMP1:%[0-9]+]]:sgpr(s32) = G_ICMP intpred(eq), [[COPY2]](s32), [[C]]
238  ; FAST:   [[TRUNC1:%[0-9]+]]:sgpr(s1) = G_TRUNC [[ICMP1]](s32)
239  ; FAST:   [[ZEXT:%[0-9]+]]:sgpr(s32) = G_ZEXT [[TRUNC1]](s1)
240  ; FAST:   [[COPY3:%[0-9]+]]:vcc(s1) = COPY [[TRUNC]](s1)
241  ; FAST:   G_BRCOND [[ZEXT]](s32), %bb.1
242  ; FAST:   G_BR %bb.2
243  ; FAST: bb.1:
244  ; FAST:   successors: %bb.2(0x80000000)
245  ; FAST:   [[COPY4:%[0-9]+]]:vgpr(s32) = COPY [[C]](s32)
246  ; FAST:   [[ICMP2:%[0-9]+]]:vcc(s1) = G_ICMP intpred(eq), [[COPY1]](s32), [[COPY4]]
247  ; FAST:   G_BR %bb.2
248  ; FAST: bb.2:
249  ; FAST:   [[PHI:%[0-9]+]]:vcc(s1) = G_PHI [[COPY3]](s1), %bb.0, [[ICMP2]](s1), %bb.1
250  ; FAST:   [[COPY5:%[0-9]+]]:vgpr(s32) = COPY [[C]](s32)
251  ; FAST:   [[COPY6:%[0-9]+]]:vgpr(s32) = COPY [[COPY]](s32)
252  ; FAST:   [[SELECT:%[0-9]+]]:vgpr(s32) = G_SELECT [[PHI]](s1), [[COPY5]], [[COPY6]]
253  ; FAST:   S_SETPC_B64 undef $sgpr30_sgpr31, implicit [[SELECT]](s32)
254  ; GREEDY-LABEL: name: phi_s1_scc_vcc_sbranch
255  ; GREEDY: bb.0:
256  ; GREEDY:   successors: %bb.1(0x40000000), %bb.2(0x40000000)
257  ; GREEDY:   liveins: $sgpr0, $sgpr1, $vgpr0
258  ; GREEDY:   [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
259  ; GREEDY:   [[COPY1:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
260  ; GREEDY:   [[COPY2:%[0-9]+]]:sgpr(s32) = COPY $sgpr1
261  ; GREEDY:   [[C:%[0-9]+]]:sgpr(s32) = G_CONSTANT i32 0
262  ; GREEDY:   [[ICMP:%[0-9]+]]:sgpr(s32) = G_ICMP intpred(eq), [[COPY]](s32), [[C]]
263  ; GREEDY:   [[TRUNC:%[0-9]+]]:sgpr(s1) = G_TRUNC [[ICMP]](s32)
264  ; GREEDY:   [[ICMP1:%[0-9]+]]:sgpr(s32) = G_ICMP intpred(eq), [[COPY2]](s32), [[C]]
265  ; GREEDY:   [[TRUNC1:%[0-9]+]]:sgpr(s1) = G_TRUNC [[ICMP1]](s32)
266  ; GREEDY:   [[ZEXT:%[0-9]+]]:sgpr(s32) = G_ZEXT [[TRUNC1]](s1)
267  ; GREEDY:   [[COPY3:%[0-9]+]]:vcc(s1) = COPY [[TRUNC]](s1)
268  ; GREEDY:   G_BRCOND [[ZEXT]](s32), %bb.1
269  ; GREEDY:   G_BR %bb.2
270  ; GREEDY: bb.1:
271  ; GREEDY:   successors: %bb.2(0x80000000)
272  ; GREEDY:   [[COPY4:%[0-9]+]]:vgpr(s32) = COPY [[C]](s32)
273  ; GREEDY:   [[ICMP2:%[0-9]+]]:vcc(s1) = G_ICMP intpred(eq), [[COPY1]](s32), [[COPY4]]
274  ; GREEDY:   G_BR %bb.2
275  ; GREEDY: bb.2:
276  ; GREEDY:   [[PHI:%[0-9]+]]:vcc(s1) = G_PHI [[COPY3]](s1), %bb.0, [[ICMP2]](s1), %bb.1
277  ; GREEDY:   [[COPY5:%[0-9]+]]:vgpr(s32) = COPY [[C]](s32)
278  ; GREEDY:   [[COPY6:%[0-9]+]]:vgpr(s32) = COPY [[COPY]](s32)
279  ; GREEDY:   [[SELECT:%[0-9]+]]:vgpr(s32) = G_SELECT [[PHI]](s1), [[COPY5]], [[COPY6]]
280  ; GREEDY:   S_SETPC_B64 undef $sgpr30_sgpr31, implicit [[SELECT]](s32)
281  bb.0:
282    successors: %bb.1, %bb.2
283    liveins: $sgpr0, $sgpr1, $vgpr0
284
285    %0:_(s32) = COPY $sgpr0
286    %1:_(s32) = COPY $vgpr0
287    %2:_(s32) = COPY $sgpr1
288    %3:_(s32) = G_CONSTANT i32 0
289    %4:_(s1) = G_ICMP intpred(eq), %0, %3
290    %5:_(s1) = G_ICMP intpred(eq), %2, %3
291    G_BRCOND %5, %bb.1
292    G_BR %bb.2
293
294  bb.1:
295    successors: %bb.2
296
297    %6:_(s1) = G_ICMP intpred(eq), %1, %3
298    G_BR %bb.2
299
300  bb.2:
301    %7:_(s1) = G_PHI %4, %bb.0, %6, %bb.1
302    %8:_(s32) = G_SELECT %7, %3, %0
303    S_SETPC_B64 undef $sgpr30_sgpr31, implicit %8
304
305...
306
307---
308name: phi_s1_vcc_scc_sbranch
309legalized: true
310tracksRegLiveness: true
311
312body: |
313  ; FAST-LABEL: name: phi_s1_vcc_scc_sbranch
314  ; FAST: bb.0:
315  ; FAST:   successors: %bb.1(0x40000000), %bb.2(0x40000000)
316  ; FAST:   liveins: $vgpr0, $sgpr0, $sgpr1
317  ; FAST:   [[COPY:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
318  ; FAST:   [[COPY1:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
319  ; FAST:   [[COPY2:%[0-9]+]]:sgpr(s32) = COPY $sgpr1
320  ; FAST:   [[C:%[0-9]+]]:sgpr(s32) = G_CONSTANT i32 0
321  ; FAST:   [[COPY3:%[0-9]+]]:vgpr(s32) = COPY [[C]](s32)
322  ; FAST:   [[ICMP:%[0-9]+]]:vcc(s1) = G_ICMP intpred(eq), [[COPY]](s32), [[COPY3]]
323  ; FAST:   [[ICMP1:%[0-9]+]]:sgpr(s32) = G_ICMP intpred(eq), [[COPY2]](s32), [[C]]
324  ; FAST:   [[TRUNC:%[0-9]+]]:sgpr(s1) = G_TRUNC [[ICMP1]](s32)
325  ; FAST:   [[ZEXT:%[0-9]+]]:sgpr(s32) = G_ZEXT [[TRUNC]](s1)
326  ; FAST:   G_BRCOND [[ZEXT]](s32), %bb.1
327  ; FAST:   G_BR %bb.2
328  ; FAST: bb.1:
329  ; FAST:   successors: %bb.2(0x80000000)
330  ; FAST:   [[ICMP2:%[0-9]+]]:sgpr(s32) = G_ICMP intpred(eq), [[COPY1]](s32), [[C]]
331  ; FAST:   [[TRUNC1:%[0-9]+]]:sgpr(s1) = G_TRUNC [[ICMP2]](s32)
332  ; FAST:   [[COPY4:%[0-9]+]]:vcc(s1) = COPY [[TRUNC1]](s1)
333  ; FAST:   G_BR %bb.2
334  ; FAST: bb.2:
335  ; FAST:   [[PHI:%[0-9]+]]:vcc(s1) = G_PHI [[ICMP]](s1), %bb.0, [[COPY4]](s1), %bb.1
336  ; FAST:   [[COPY5:%[0-9]+]]:vgpr(s32) = COPY [[C]](s32)
337  ; FAST:   [[COPY6:%[0-9]+]]:vgpr(s32) = COPY [[COPY1]](s32)
338  ; FAST:   [[SELECT:%[0-9]+]]:vgpr(s32) = G_SELECT [[PHI]](s1), [[COPY5]], [[COPY6]]
339  ; FAST:   S_SETPC_B64 undef $sgpr30_sgpr31, implicit [[SELECT]](s32)
340  ; GREEDY-LABEL: name: phi_s1_vcc_scc_sbranch
341  ; GREEDY: bb.0:
342  ; GREEDY:   successors: %bb.1(0x40000000), %bb.2(0x40000000)
343  ; GREEDY:   liveins: $vgpr0, $sgpr0, $sgpr1
344  ; GREEDY:   [[COPY:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
345  ; GREEDY:   [[COPY1:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
346  ; GREEDY:   [[COPY2:%[0-9]+]]:sgpr(s32) = COPY $sgpr1
347  ; GREEDY:   [[C:%[0-9]+]]:sgpr(s32) = G_CONSTANT i32 0
348  ; GREEDY:   [[COPY3:%[0-9]+]]:vgpr(s32) = COPY [[C]](s32)
349  ; GREEDY:   [[ICMP:%[0-9]+]]:vcc(s1) = G_ICMP intpred(eq), [[COPY]](s32), [[COPY3]]
350  ; GREEDY:   [[ICMP1:%[0-9]+]]:sgpr(s32) = G_ICMP intpred(eq), [[COPY2]](s32), [[C]]
351  ; GREEDY:   [[TRUNC:%[0-9]+]]:sgpr(s1) = G_TRUNC [[ICMP1]](s32)
352  ; GREEDY:   [[ZEXT:%[0-9]+]]:sgpr(s32) = G_ZEXT [[TRUNC]](s1)
353  ; GREEDY:   G_BRCOND [[ZEXT]](s32), %bb.1
354  ; GREEDY:   G_BR %bb.2
355  ; GREEDY: bb.1:
356  ; GREEDY:   successors: %bb.2(0x80000000)
357  ; GREEDY:   [[ICMP2:%[0-9]+]]:sgpr(s32) = G_ICMP intpred(eq), [[COPY1]](s32), [[C]]
358  ; GREEDY:   [[TRUNC1:%[0-9]+]]:sgpr(s1) = G_TRUNC [[ICMP2]](s32)
359  ; GREEDY:   [[COPY4:%[0-9]+]]:vcc(s1) = COPY [[TRUNC1]](s1)
360  ; GREEDY:   G_BR %bb.2
361  ; GREEDY: bb.2:
362  ; GREEDY:   [[PHI:%[0-9]+]]:vcc(s1) = G_PHI [[ICMP]](s1), %bb.0, [[COPY4]](s1), %bb.1
363  ; GREEDY:   [[COPY5:%[0-9]+]]:vgpr(s32) = COPY [[C]](s32)
364  ; GREEDY:   [[COPY6:%[0-9]+]]:vgpr(s32) = COPY [[COPY1]](s32)
365  ; GREEDY:   [[SELECT:%[0-9]+]]:vgpr(s32) = G_SELECT [[PHI]](s1), [[COPY5]], [[COPY6]]
366  ; GREEDY:   S_SETPC_B64 undef $sgpr30_sgpr31, implicit [[SELECT]](s32)
367  bb.0:
368    successors: %bb.1, %bb.2
369    liveins: $vgpr0, $sgpr0, $sgpr1
370
371    %0:_(s32) = COPY $vgpr0
372    %1:_(s32) = COPY $sgpr0
373    %2:_(s32) = COPY $sgpr1
374    %3:_(s32) = G_CONSTANT i32 0
375    %4:_(s1) = G_ICMP intpred(eq), %0, %3
376    %5:_(s1) = G_ICMP intpred(eq), %2, %3
377    G_BRCOND %5, %bb.1
378    G_BR %bb.2
379
380  bb.1:
381    successors: %bb.2
382
383    %6:_(s1) = G_ICMP intpred(eq), %1, %3
384    G_BR %bb.2
385
386  bb.2:
387    %7:_(s1) = G_PHI %4, %bb.0, %6, %bb.1
388    %8:_(s32) = G_SELECT %7, %3, %1
389    S_SETPC_B64 undef $sgpr30_sgpr31, implicit %8
390
391...
392
393---
394name: phi_s1_vcc_vcc_sbranch
395legalized: true
396tracksRegLiveness: true
397
398body: |
399  ; FAST-LABEL: name: phi_s1_vcc_vcc_sbranch
400  ; FAST: bb.0:
401  ; FAST:   successors: %bb.1(0x40000000), %bb.2(0x40000000)
402  ; FAST:   liveins: $vgpr0, $vgpr1, $sgpr0
403  ; FAST:   [[COPY:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
404  ; FAST:   [[COPY1:%[0-9]+]]:vgpr(s32) = COPY $vgpr1
405  ; FAST:   [[COPY2:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
406  ; FAST:   [[C:%[0-9]+]]:sgpr(s32) = G_CONSTANT i32 0
407  ; FAST:   [[COPY3:%[0-9]+]]:vgpr(s32) = COPY [[C]](s32)
408  ; FAST:   [[ICMP:%[0-9]+]]:vcc(s1) = G_ICMP intpred(eq), [[COPY]](s32), [[COPY3]]
409  ; FAST:   [[ICMP1:%[0-9]+]]:sgpr(s32) = G_ICMP intpred(eq), [[COPY2]](s32), [[C]]
410  ; FAST:   [[TRUNC:%[0-9]+]]:sgpr(s1) = G_TRUNC [[ICMP1]](s32)
411  ; FAST:   [[ZEXT:%[0-9]+]]:sgpr(s32) = G_ZEXT [[TRUNC]](s1)
412  ; FAST:   G_BRCOND [[ZEXT]](s32), %bb.1
413  ; FAST:   G_BR %bb.2
414  ; FAST: bb.1:
415  ; FAST:   successors: %bb.2(0x80000000)
416  ; FAST:   [[COPY4:%[0-9]+]]:vgpr(s32) = COPY [[C]](s32)
417  ; FAST:   [[ICMP2:%[0-9]+]]:vcc(s1) = G_ICMP intpred(eq), [[COPY1]](s32), [[COPY4]]
418  ; FAST:   G_BR %bb.2
419  ; FAST: bb.2:
420  ; FAST:   [[PHI:%[0-9]+]]:vcc(s1) = G_PHI [[ICMP]](s1), %bb.0, [[ICMP2]](s1), %bb.1
421  ; FAST:   [[COPY5:%[0-9]+]]:vgpr(s32) = COPY [[C]](s32)
422  ; FAST:   [[SELECT:%[0-9]+]]:vgpr(s32) = G_SELECT [[PHI]](s1), [[COPY5]], [[COPY]]
423  ; FAST:   S_SETPC_B64 undef $sgpr30_sgpr31, implicit [[SELECT]](s32)
424  ; GREEDY-LABEL: name: phi_s1_vcc_vcc_sbranch
425  ; GREEDY: bb.0:
426  ; GREEDY:   successors: %bb.1(0x40000000), %bb.2(0x40000000)
427  ; GREEDY:   liveins: $vgpr0, $vgpr1, $sgpr0
428  ; GREEDY:   [[COPY:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
429  ; GREEDY:   [[COPY1:%[0-9]+]]:vgpr(s32) = COPY $vgpr1
430  ; GREEDY:   [[COPY2:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
431  ; GREEDY:   [[C:%[0-9]+]]:sgpr(s32) = G_CONSTANT i32 0
432  ; GREEDY:   [[COPY3:%[0-9]+]]:vgpr(s32) = COPY [[C]](s32)
433  ; GREEDY:   [[ICMP:%[0-9]+]]:vcc(s1) = G_ICMP intpred(eq), [[COPY]](s32), [[COPY3]]
434  ; GREEDY:   [[ICMP1:%[0-9]+]]:sgpr(s32) = G_ICMP intpred(eq), [[COPY2]](s32), [[C]]
435  ; GREEDY:   [[TRUNC:%[0-9]+]]:sgpr(s1) = G_TRUNC [[ICMP1]](s32)
436  ; GREEDY:   [[ZEXT:%[0-9]+]]:sgpr(s32) = G_ZEXT [[TRUNC]](s1)
437  ; GREEDY:   G_BRCOND [[ZEXT]](s32), %bb.1
438  ; GREEDY:   G_BR %bb.2
439  ; GREEDY: bb.1:
440  ; GREEDY:   successors: %bb.2(0x80000000)
441  ; GREEDY:   [[COPY4:%[0-9]+]]:vgpr(s32) = COPY [[C]](s32)
442  ; GREEDY:   [[ICMP2:%[0-9]+]]:vcc(s1) = G_ICMP intpred(eq), [[COPY1]](s32), [[COPY4]]
443  ; GREEDY:   G_BR %bb.2
444  ; GREEDY: bb.2:
445  ; GREEDY:   [[PHI:%[0-9]+]]:vcc(s1) = G_PHI [[ICMP]](s1), %bb.0, [[ICMP2]](s1), %bb.1
446  ; GREEDY:   [[COPY5:%[0-9]+]]:vgpr(s32) = COPY [[C]](s32)
447  ; GREEDY:   [[SELECT:%[0-9]+]]:vgpr(s32) = G_SELECT [[PHI]](s1), [[COPY5]], [[COPY]]
448  ; GREEDY:   S_SETPC_B64 undef $sgpr30_sgpr31, implicit [[SELECT]](s32)
449  bb.0:
450    successors: %bb.1, %bb.2
451    liveins: $vgpr0, $vgpr1, $sgpr0
452
453    %0:_(s32) = COPY $vgpr0
454    %1:_(s32) = COPY $vgpr1
455    %2:_(s32) = COPY $sgpr0
456    %3:_(s32) = G_CONSTANT i32 0
457    %4:_(s1) = G_ICMP intpred(eq), %0, %3
458    %5:_(s1) = G_ICMP intpred(eq), %2, %3
459    G_BRCOND %5, %bb.1
460    G_BR %bb.2
461
462  bb.1:
463    successors: %bb.2
464
465    %6:_(s1) = G_ICMP intpred(eq), %1, %3
466    G_BR %bb.2
467
468  bb.2:
469    %7:_(s1) = G_PHI %4, %bb.0, %6, %bb.1
470    %8:_(s32) = G_SELECT %7, %3, %0
471    S_SETPC_B64 undef $sgpr30_sgpr31, implicit %8
472
473...
474
475---
476name: phi_s1_s_scc_sbranch
477legalized: true
478tracksRegLiveness: true
479
480body: |
481  ; FAST-LABEL: name: phi_s1_s_scc_sbranch
482  ; FAST: bb.0:
483  ; FAST:   successors: %bb.1(0x40000000), %bb.2(0x40000000)
484  ; FAST:   liveins: $sgpr0, $sgpr1, $sgpr2
485  ; FAST:   [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
486  ; FAST:   [[COPY1:%[0-9]+]]:sgpr(s32) = COPY $sgpr1
487  ; FAST:   [[COPY2:%[0-9]+]]:sgpr(s32) = COPY $sgpr2
488  ; FAST:   [[C:%[0-9]+]]:sgpr(s32) = G_CONSTANT i32 0
489  ; FAST:   [[TRUNC:%[0-9]+]]:sgpr(s1) = G_TRUNC [[COPY]](s32)
490  ; FAST:   [[ICMP:%[0-9]+]]:sgpr(s32) = G_ICMP intpred(eq), [[COPY2]](s32), [[C]]
491  ; FAST:   [[TRUNC1:%[0-9]+]]:sgpr(s1) = G_TRUNC [[ICMP]](s32)
492  ; FAST:   [[ZEXT:%[0-9]+]]:sgpr(s32) = G_ZEXT [[TRUNC1]](s1)
493  ; FAST:   [[ANYEXT:%[0-9]+]]:sgpr(s32) = G_ANYEXT [[TRUNC]](s1)
494  ; FAST:   G_BRCOND [[ZEXT]](s32), %bb.1
495  ; FAST:   G_BR %bb.2
496  ; FAST: bb.1:
497  ; FAST:   successors: %bb.2(0x80000000)
498  ; FAST:   [[ICMP1:%[0-9]+]]:sgpr(s32) = G_ICMP intpred(eq), [[COPY1]](s32), [[C]]
499  ; FAST:   [[TRUNC2:%[0-9]+]]:sgpr(s1) = G_TRUNC [[ICMP1]](s32)
500  ; FAST:   [[ANYEXT1:%[0-9]+]]:sgpr(s32) = G_ANYEXT [[TRUNC2]](s1)
501  ; FAST:   G_BR %bb.2
502  ; FAST: bb.2:
503  ; FAST:   [[PHI:%[0-9]+]]:sgpr(s32) = G_PHI [[ANYEXT]](s32), %bb.0, [[ANYEXT1]](s32), %bb.1
504  ; FAST:   [[TRUNC3:%[0-9]+]]:sgpr(s1) = G_TRUNC [[PHI]](s32)
505  ; FAST:   [[ZEXT1:%[0-9]+]]:sgpr(s32) = G_ZEXT [[TRUNC3]](s1)
506  ; FAST:   [[SELECT:%[0-9]+]]:sgpr(s32) = G_SELECT [[ZEXT1]](s32), [[C]], [[COPY]]
507  ; FAST:   S_SETPC_B64 undef $sgpr30_sgpr31, implicit [[SELECT]](s32)
508  ; GREEDY-LABEL: name: phi_s1_s_scc_sbranch
509  ; GREEDY: bb.0:
510  ; GREEDY:   successors: %bb.1(0x40000000), %bb.2(0x40000000)
511  ; GREEDY:   liveins: $sgpr0, $sgpr1, $sgpr2
512  ; GREEDY:   [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
513  ; GREEDY:   [[COPY1:%[0-9]+]]:sgpr(s32) = COPY $sgpr1
514  ; GREEDY:   [[COPY2:%[0-9]+]]:sgpr(s32) = COPY $sgpr2
515  ; GREEDY:   [[C:%[0-9]+]]:sgpr(s32) = G_CONSTANT i32 0
516  ; GREEDY:   [[TRUNC:%[0-9]+]]:sgpr(s1) = G_TRUNC [[COPY]](s32)
517  ; GREEDY:   [[ICMP:%[0-9]+]]:sgpr(s32) = G_ICMP intpred(eq), [[COPY2]](s32), [[C]]
518  ; GREEDY:   [[TRUNC1:%[0-9]+]]:sgpr(s1) = G_TRUNC [[ICMP]](s32)
519  ; GREEDY:   [[ZEXT:%[0-9]+]]:sgpr(s32) = G_ZEXT [[TRUNC1]](s1)
520  ; GREEDY:   [[ANYEXT:%[0-9]+]]:sgpr(s32) = G_ANYEXT [[TRUNC]](s1)
521  ; GREEDY:   G_BRCOND [[ZEXT]](s32), %bb.1
522  ; GREEDY:   G_BR %bb.2
523  ; GREEDY: bb.1:
524  ; GREEDY:   successors: %bb.2(0x80000000)
525  ; GREEDY:   [[ICMP1:%[0-9]+]]:sgpr(s32) = G_ICMP intpred(eq), [[COPY1]](s32), [[C]]
526  ; GREEDY:   [[TRUNC2:%[0-9]+]]:sgpr(s1) = G_TRUNC [[ICMP1]](s32)
527  ; GREEDY:   [[ANYEXT1:%[0-9]+]]:sgpr(s32) = G_ANYEXT [[TRUNC2]](s1)
528  ; GREEDY:   G_BR %bb.2
529  ; GREEDY: bb.2:
530  ; GREEDY:   [[PHI:%[0-9]+]]:sgpr(s32) = G_PHI [[ANYEXT]](s32), %bb.0, [[ANYEXT1]](s32), %bb.1
531  ; GREEDY:   [[TRUNC3:%[0-9]+]]:sgpr(s1) = G_TRUNC [[PHI]](s32)
532  ; GREEDY:   [[ZEXT1:%[0-9]+]]:sgpr(s32) = G_ZEXT [[TRUNC3]](s1)
533  ; GREEDY:   [[SELECT:%[0-9]+]]:sgpr(s32) = G_SELECT [[ZEXT1]](s32), [[C]], [[COPY]]
534  ; GREEDY:   S_SETPC_B64 undef $sgpr30_sgpr31, implicit [[SELECT]](s32)
535  bb.0:
536    successors: %bb.1, %bb.2
537    liveins: $sgpr0, $sgpr1, $sgpr2
538
539    %0:_(s32) = COPY $sgpr0
540    %1:_(s32) = COPY $sgpr1
541    %2:_(s32) = COPY $sgpr2
542    %3:_(s32) = G_CONSTANT i32 0
543    %4:_(s1) = G_TRUNC %0
544    %5:_(s1) = G_ICMP intpred(eq), %2, %3
545    G_BRCOND %5, %bb.1
546    G_BR %bb.2
547
548  bb.1:
549    successors: %bb.2
550
551    %6:_(s1) = G_ICMP intpred(eq), %1, %3
552    G_BR %bb.2
553
554  bb.2:
555    %7:_(s1) = G_PHI %4, %bb.0, %6, %bb.1
556    %8:_(s32) = G_SELECT %7, %3, %0
557    S_SETPC_B64 undef $sgpr30_sgpr31, implicit %8
558
559...
560
561---
562name: phi_s1_scc_s_sbranch
563legalized: true
564tracksRegLiveness: true
565
566body: |
567  ; FAST-LABEL: name: phi_s1_scc_s_sbranch
568  ; FAST: bb.0:
569  ; FAST:   successors: %bb.1(0x40000000), %bb.2(0x40000000)
570  ; FAST:   liveins: $sgpr0, $sgpr1, $sgpr2
571  ; FAST:   [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
572  ; FAST:   [[COPY1:%[0-9]+]]:sgpr(s32) = COPY $sgpr1
573  ; FAST:   [[COPY2:%[0-9]+]]:sgpr(s32) = COPY $sgpr2
574  ; FAST:   [[C:%[0-9]+]]:sgpr(s32) = G_CONSTANT i32 0
575  ; FAST:   [[ICMP:%[0-9]+]]:sgpr(s32) = G_ICMP intpred(eq), [[COPY]](s32), [[C]]
576  ; FAST:   [[TRUNC:%[0-9]+]]:sgpr(s1) = G_TRUNC [[ICMP]](s32)
577  ; FAST:   [[ICMP1:%[0-9]+]]:sgpr(s32) = G_ICMP intpred(eq), [[COPY2]](s32), [[C]]
578  ; FAST:   [[TRUNC1:%[0-9]+]]:sgpr(s1) = G_TRUNC [[ICMP1]](s32)
579  ; FAST:   [[ZEXT:%[0-9]+]]:sgpr(s32) = G_ZEXT [[TRUNC1]](s1)
580  ; FAST:   [[ANYEXT:%[0-9]+]]:sgpr(s32) = G_ANYEXT [[TRUNC]](s1)
581  ; FAST:   G_BRCOND [[ZEXT]](s32), %bb.1
582  ; FAST:   G_BR %bb.2
583  ; FAST: bb.1:
584  ; FAST:   successors: %bb.2(0x80000000)
585  ; FAST:   [[TRUNC2:%[0-9]+]]:sgpr(s1) = G_TRUNC [[COPY1]](s32)
586  ; FAST:   [[ANYEXT1:%[0-9]+]]:sgpr(s32) = G_ANYEXT [[TRUNC2]](s1)
587  ; FAST:   G_BR %bb.2
588  ; FAST: bb.2:
589  ; FAST:   [[PHI:%[0-9]+]]:sgpr(s32) = G_PHI [[ANYEXT]](s32), %bb.0, [[ANYEXT1]](s32), %bb.1
590  ; FAST:   [[TRUNC3:%[0-9]+]]:sgpr(s1) = G_TRUNC [[PHI]](s32)
591  ; FAST:   [[ZEXT1:%[0-9]+]]:sgpr(s32) = G_ZEXT [[TRUNC3]](s1)
592  ; FAST:   [[SELECT:%[0-9]+]]:sgpr(s32) = G_SELECT [[ZEXT1]](s32), [[C]], [[COPY]]
593  ; FAST:   S_SETPC_B64 undef $sgpr30_sgpr31, implicit [[SELECT]](s32)
594  ; GREEDY-LABEL: name: phi_s1_scc_s_sbranch
595  ; GREEDY: bb.0:
596  ; GREEDY:   successors: %bb.1(0x40000000), %bb.2(0x40000000)
597  ; GREEDY:   liveins: $sgpr0, $sgpr1, $sgpr2
598  ; GREEDY:   [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
599  ; GREEDY:   [[COPY1:%[0-9]+]]:sgpr(s32) = COPY $sgpr1
600  ; GREEDY:   [[COPY2:%[0-9]+]]:sgpr(s32) = COPY $sgpr2
601  ; GREEDY:   [[C:%[0-9]+]]:sgpr(s32) = G_CONSTANT i32 0
602  ; GREEDY:   [[ICMP:%[0-9]+]]:sgpr(s32) = G_ICMP intpred(eq), [[COPY]](s32), [[C]]
603  ; GREEDY:   [[TRUNC:%[0-9]+]]:sgpr(s1) = G_TRUNC [[ICMP]](s32)
604  ; GREEDY:   [[ICMP1:%[0-9]+]]:sgpr(s32) = G_ICMP intpred(eq), [[COPY2]](s32), [[C]]
605  ; GREEDY:   [[TRUNC1:%[0-9]+]]:sgpr(s1) = G_TRUNC [[ICMP1]](s32)
606  ; GREEDY:   [[ZEXT:%[0-9]+]]:sgpr(s32) = G_ZEXT [[TRUNC1]](s1)
607  ; GREEDY:   [[ANYEXT:%[0-9]+]]:sgpr(s32) = G_ANYEXT [[TRUNC]](s1)
608  ; GREEDY:   G_BRCOND [[ZEXT]](s32), %bb.1
609  ; GREEDY:   G_BR %bb.2
610  ; GREEDY: bb.1:
611  ; GREEDY:   successors: %bb.2(0x80000000)
612  ; GREEDY:   [[TRUNC2:%[0-9]+]]:sgpr(s1) = G_TRUNC [[COPY1]](s32)
613  ; GREEDY:   [[ANYEXT1:%[0-9]+]]:sgpr(s32) = G_ANYEXT [[TRUNC2]](s1)
614  ; GREEDY:   G_BR %bb.2
615  ; GREEDY: bb.2:
616  ; GREEDY:   [[PHI:%[0-9]+]]:sgpr(s32) = G_PHI [[ANYEXT]](s32), %bb.0, [[ANYEXT1]](s32), %bb.1
617  ; GREEDY:   [[TRUNC3:%[0-9]+]]:sgpr(s1) = G_TRUNC [[PHI]](s32)
618  ; GREEDY:   [[ZEXT1:%[0-9]+]]:sgpr(s32) = G_ZEXT [[TRUNC3]](s1)
619  ; GREEDY:   [[SELECT:%[0-9]+]]:sgpr(s32) = G_SELECT [[ZEXT1]](s32), [[C]], [[COPY]]
620  ; GREEDY:   S_SETPC_B64 undef $sgpr30_sgpr31, implicit [[SELECT]](s32)
621  bb.0:
622    successors: %bb.1, %bb.2
623    liveins: $sgpr0, $sgpr1, $sgpr2
624
625    %0:_(s32) = COPY $sgpr0
626    %1:_(s32) = COPY $sgpr1
627    %2:_(s32) = COPY $sgpr2
628    %3:_(s32) = G_CONSTANT i32 0
629    %4:_(s1) = G_ICMP intpred(eq), %0, %3
630    %5:_(s1) = G_ICMP intpred(eq), %2, %3
631    G_BRCOND %5, %bb.1
632    G_BR %bb.2
633
634  bb.1:
635    successors: %bb.2
636
637    %6:_(s1) = G_TRUNC %1
638    G_BR %bb.2
639
640  bb.2:
641    %7:_(s1) = G_PHI %4, %bb.0, %6, %bb.1
642    %8:_(s32) = G_SELECT %7, %3, %0
643    S_SETPC_B64 undef $sgpr30_sgpr31, implicit %8
644
645...
646
647---
648name: phi_s1_scc_v_sbranch
649legalized: true
650tracksRegLiveness: true
651
652body: |
653  ; FAST-LABEL: name: phi_s1_scc_v_sbranch
654  ; FAST: bb.0:
655  ; FAST:   successors: %bb.1(0x40000000), %bb.2(0x40000000)
656  ; FAST:   liveins: $vgpr0, $sgpr0, $sgpr1, $sgpr2
657  ; FAST:   [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
658  ; FAST:   [[COPY1:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
659  ; FAST:   [[COPY2:%[0-9]+]]:sgpr(s32) = COPY $sgpr2
660  ; FAST:   [[C:%[0-9]+]]:sgpr(s32) = G_CONSTANT i32 0
661  ; FAST:   [[ICMP:%[0-9]+]]:sgpr(s32) = G_ICMP intpred(eq), [[COPY]](s32), [[C]]
662  ; FAST:   [[TRUNC:%[0-9]+]]:sgpr(s1) = G_TRUNC [[ICMP]](s32)
663  ; FAST:   [[ICMP1:%[0-9]+]]:sgpr(s32) = G_ICMP intpred(eq), [[COPY2]](s32), [[C]]
664  ; FAST:   [[TRUNC1:%[0-9]+]]:sgpr(s1) = G_TRUNC [[ICMP1]](s32)
665  ; FAST:   [[ZEXT:%[0-9]+]]:sgpr(s32) = G_ZEXT [[TRUNC1]](s1)
666  ; FAST:   [[ANYEXT:%[0-9]+]]:vgpr(s32) = G_ANYEXT [[TRUNC]](s1)
667  ; FAST:   G_BRCOND [[ZEXT]](s32), %bb.1
668  ; FAST:   G_BR %bb.2
669  ; FAST: bb.1:
670  ; FAST:   successors: %bb.2(0x80000000)
671  ; FAST:   [[TRUNC2:%[0-9]+]]:vgpr(s1) = G_TRUNC [[COPY1]](s32)
672  ; FAST:   [[ANYEXT1:%[0-9]+]]:vgpr(s32) = G_ANYEXT [[TRUNC2]](s1)
673  ; FAST:   G_BR %bb.2
674  ; FAST: bb.2:
675  ; FAST:   [[PHI:%[0-9]+]]:vgpr(s32) = G_PHI [[ANYEXT]](s32), %bb.0, [[ANYEXT1]](s32), %bb.1
676  ; FAST:   [[TRUNC3:%[0-9]+]]:vgpr(s1) = G_TRUNC [[PHI]](s32)
677  ; FAST:   [[COPY3:%[0-9]+]]:vcc(s1) = COPY [[TRUNC3]](s1)
678  ; FAST:   [[COPY4:%[0-9]+]]:vgpr(s32) = COPY [[C]](s32)
679  ; FAST:   [[COPY5:%[0-9]+]]:vgpr(s32) = COPY [[COPY]](s32)
680  ; FAST:   [[SELECT:%[0-9]+]]:vgpr(s32) = G_SELECT [[COPY3]](s1), [[COPY4]], [[COPY5]]
681  ; FAST:   S_SETPC_B64 undef $sgpr30_sgpr31, implicit [[SELECT]](s32)
682  ; GREEDY-LABEL: name: phi_s1_scc_v_sbranch
683  ; GREEDY: bb.0:
684  ; GREEDY:   successors: %bb.1(0x40000000), %bb.2(0x40000000)
685  ; GREEDY:   liveins: $vgpr0, $sgpr0, $sgpr1, $sgpr2
686  ; GREEDY:   [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
687  ; GREEDY:   [[COPY1:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
688  ; GREEDY:   [[COPY2:%[0-9]+]]:sgpr(s32) = COPY $sgpr2
689  ; GREEDY:   [[C:%[0-9]+]]:sgpr(s32) = G_CONSTANT i32 0
690  ; GREEDY:   [[ICMP:%[0-9]+]]:sgpr(s32) = G_ICMP intpred(eq), [[COPY]](s32), [[C]]
691  ; GREEDY:   [[TRUNC:%[0-9]+]]:sgpr(s1) = G_TRUNC [[ICMP]](s32)
692  ; GREEDY:   [[ICMP1:%[0-9]+]]:sgpr(s32) = G_ICMP intpred(eq), [[COPY2]](s32), [[C]]
693  ; GREEDY:   [[TRUNC1:%[0-9]+]]:sgpr(s1) = G_TRUNC [[ICMP1]](s32)
694  ; GREEDY:   [[ZEXT:%[0-9]+]]:sgpr(s32) = G_ZEXT [[TRUNC1]](s1)
695  ; GREEDY:   [[ANYEXT:%[0-9]+]]:vgpr(s32) = G_ANYEXT [[TRUNC]](s1)
696  ; GREEDY:   G_BRCOND [[ZEXT]](s32), %bb.1
697  ; GREEDY:   G_BR %bb.2
698  ; GREEDY: bb.1:
699  ; GREEDY:   successors: %bb.2(0x80000000)
700  ; GREEDY:   [[TRUNC2:%[0-9]+]]:vgpr(s1) = G_TRUNC [[COPY1]](s32)
701  ; GREEDY:   [[ANYEXT1:%[0-9]+]]:vgpr(s32) = G_ANYEXT [[TRUNC2]](s1)
702  ; GREEDY:   G_BR %bb.2
703  ; GREEDY: bb.2:
704  ; GREEDY:   [[PHI:%[0-9]+]]:vgpr(s32) = G_PHI [[ANYEXT]](s32), %bb.0, [[ANYEXT1]](s32), %bb.1
705  ; GREEDY:   [[TRUNC3:%[0-9]+]]:vgpr(s1) = G_TRUNC [[PHI]](s32)
706  ; GREEDY:   [[COPY3:%[0-9]+]]:vcc(s1) = COPY [[TRUNC3]](s1)
707  ; GREEDY:   [[COPY4:%[0-9]+]]:vgpr(s32) = COPY [[C]](s32)
708  ; GREEDY:   [[COPY5:%[0-9]+]]:vgpr(s32) = COPY [[COPY]](s32)
709  ; GREEDY:   [[SELECT:%[0-9]+]]:vgpr(s32) = G_SELECT [[COPY3]](s1), [[COPY4]], [[COPY5]]
710  ; GREEDY:   S_SETPC_B64 undef $sgpr30_sgpr31, implicit [[SELECT]](s32)
711  bb.0:
712    successors: %bb.1, %bb.2
713    liveins: $vgpr0, $sgpr0, $sgpr1, $sgpr2
714
715    %0:_(s32) = COPY $sgpr0
716    %1:_(s32) = COPY $vgpr0
717    %2:_(s32) = COPY $sgpr2
718    %3:_(s32) = G_CONSTANT i32 0
719    %4:_(s1) = G_ICMP intpred(eq), %0, %3
720    %5:_(s1) = G_ICMP intpred(eq), %2, %3
721    G_BRCOND %5, %bb.1
722    G_BR %bb.2
723
724  bb.1:
725    successors: %bb.2
726
727    %6:_(s1) = G_TRUNC %1
728    G_BR %bb.2
729
730  bb.2:
731    %7:_(s1) = G_PHI %4, %bb.0, %6, %bb.1
732    %8:_(s32) = G_SELECT %7, %3, %0
733    S_SETPC_B64 undef $sgpr30_sgpr31, implicit %8
734
735...
736
737---
738name: phi_s1_v_scc_sbranch
739legalized: true
740tracksRegLiveness: true
741
742body: |
743  ; FAST-LABEL: name: phi_s1_v_scc_sbranch
744  ; FAST: bb.0:
745  ; FAST:   successors: %bb.1(0x40000000), %bb.2(0x40000000)
746  ; FAST:   liveins: $vgpr0, $sgpr0, $sgpr1
747  ; FAST:   [[COPY:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
748  ; FAST:   [[COPY1:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
749  ; FAST:   [[COPY2:%[0-9]+]]:sgpr(s32) = COPY $sgpr1
750  ; FAST:   [[C:%[0-9]+]]:sgpr(s32) = G_CONSTANT i32 0
751  ; FAST:   [[TRUNC:%[0-9]+]]:vgpr(s1) = G_TRUNC [[COPY]](s32)
752  ; FAST:   [[ICMP:%[0-9]+]]:sgpr(s32) = G_ICMP intpred(eq), [[COPY2]](s32), [[C]]
753  ; FAST:   [[TRUNC1:%[0-9]+]]:sgpr(s1) = G_TRUNC [[ICMP]](s32)
754  ; FAST:   [[ZEXT:%[0-9]+]]:sgpr(s32) = G_ZEXT [[TRUNC1]](s1)
755  ; FAST:   [[ANYEXT:%[0-9]+]]:vgpr(s32) = G_ANYEXT [[TRUNC]](s1)
756  ; FAST:   G_BRCOND [[ZEXT]](s32), %bb.1
757  ; FAST:   G_BR %bb.2
758  ; FAST: bb.1:
759  ; FAST:   successors: %bb.2(0x80000000)
760  ; FAST:   [[ICMP1:%[0-9]+]]:sgpr(s32) = G_ICMP intpred(eq), [[COPY1]](s32), [[C]]
761  ; FAST:   [[TRUNC2:%[0-9]+]]:sgpr(s1) = G_TRUNC [[ICMP1]](s32)
762  ; FAST:   [[ANYEXT1:%[0-9]+]]:vgpr(s32) = G_ANYEXT [[TRUNC2]](s1)
763  ; FAST:   G_BR %bb.2
764  ; FAST: bb.2:
765  ; FAST:   [[PHI:%[0-9]+]]:vgpr(s32) = G_PHI [[ANYEXT]](s32), %bb.0, [[ANYEXT1]](s32), %bb.1
766  ; FAST:   [[TRUNC3:%[0-9]+]]:vgpr(s1) = G_TRUNC [[PHI]](s32)
767  ; FAST:   [[COPY3:%[0-9]+]]:vcc(s1) = COPY [[TRUNC3]](s1)
768  ; FAST:   [[COPY4:%[0-9]+]]:vgpr(s32) = COPY [[C]](s32)
769  ; FAST:   [[SELECT:%[0-9]+]]:vgpr(s32) = G_SELECT [[COPY3]](s1), [[COPY4]], [[COPY]]
770  ; FAST:   S_SETPC_B64 undef $sgpr30_sgpr31, implicit [[SELECT]](s32)
771  ; GREEDY-LABEL: name: phi_s1_v_scc_sbranch
772  ; GREEDY: bb.0:
773  ; GREEDY:   successors: %bb.1(0x40000000), %bb.2(0x40000000)
774  ; GREEDY:   liveins: $vgpr0, $sgpr0, $sgpr1
775  ; GREEDY:   [[COPY:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
776  ; GREEDY:   [[COPY1:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
777  ; GREEDY:   [[COPY2:%[0-9]+]]:sgpr(s32) = COPY $sgpr1
778  ; GREEDY:   [[C:%[0-9]+]]:sgpr(s32) = G_CONSTANT i32 0
779  ; GREEDY:   [[TRUNC:%[0-9]+]]:vgpr(s1) = G_TRUNC [[COPY]](s32)
780  ; GREEDY:   [[ICMP:%[0-9]+]]:sgpr(s32) = G_ICMP intpred(eq), [[COPY2]](s32), [[C]]
781  ; GREEDY:   [[TRUNC1:%[0-9]+]]:sgpr(s1) = G_TRUNC [[ICMP]](s32)
782  ; GREEDY:   [[ZEXT:%[0-9]+]]:sgpr(s32) = G_ZEXT [[TRUNC1]](s1)
783  ; GREEDY:   [[ANYEXT:%[0-9]+]]:vgpr(s32) = G_ANYEXT [[TRUNC]](s1)
784  ; GREEDY:   G_BRCOND [[ZEXT]](s32), %bb.1
785  ; GREEDY:   G_BR %bb.2
786  ; GREEDY: bb.1:
787  ; GREEDY:   successors: %bb.2(0x80000000)
788  ; GREEDY:   [[ICMP1:%[0-9]+]]:sgpr(s32) = G_ICMP intpred(eq), [[COPY1]](s32), [[C]]
789  ; GREEDY:   [[TRUNC2:%[0-9]+]]:sgpr(s1) = G_TRUNC [[ICMP1]](s32)
790  ; GREEDY:   [[ANYEXT1:%[0-9]+]]:vgpr(s32) = G_ANYEXT [[TRUNC2]](s1)
791  ; GREEDY:   G_BR %bb.2
792  ; GREEDY: bb.2:
793  ; GREEDY:   [[PHI:%[0-9]+]]:vgpr(s32) = G_PHI [[ANYEXT]](s32), %bb.0, [[ANYEXT1]](s32), %bb.1
794  ; GREEDY:   [[TRUNC3:%[0-9]+]]:vgpr(s1) = G_TRUNC [[PHI]](s32)
795  ; GREEDY:   [[COPY3:%[0-9]+]]:vcc(s1) = COPY [[TRUNC3]](s1)
796  ; GREEDY:   [[COPY4:%[0-9]+]]:vgpr(s32) = COPY [[C]](s32)
797  ; GREEDY:   [[SELECT:%[0-9]+]]:vgpr(s32) = G_SELECT [[COPY3]](s1), [[COPY4]], [[COPY]]
798  ; GREEDY:   S_SETPC_B64 undef $sgpr30_sgpr31, implicit [[SELECT]](s32)
799  bb.0:
800    successors: %bb.1, %bb.2
801    liveins: $vgpr0, $sgpr0, $sgpr1
802
803    %0:_(s32) = COPY $vgpr0
804    %1:_(s32) = COPY $sgpr0
805    %2:_(s32) = COPY $sgpr1
806    %3:_(s32) = G_CONSTANT i32 0
807    %4:_(s1) = G_TRUNC %0
808    %5:_(s1) = G_ICMP intpred(eq), %2, %3
809    G_BRCOND %5, %bb.1
810    G_BR %bb.2
811
812  bb.1:
813    successors: %bb.2
814
815    %6:_(s1) = G_ICMP intpred(eq), %1, %3
816    G_BR %bb.2
817
818  bb.2:
819    %7:_(s1) = G_PHI %4, %bb.0, %6, %bb.1
820    %8:_(s32) = G_SELECT %7, %3, %0
821    S_SETPC_B64 undef $sgpr30_sgpr31, implicit %8
822
823...
824
825---
826name: phi_s1_vcc_s_sbranch
827legalized: true
828tracksRegLiveness: true
829
830body: |
831  ; FAST-LABEL: name: phi_s1_vcc_s_sbranch
832  ; FAST: bb.0:
833  ; FAST:   successors: %bb.1(0x40000000), %bb.2(0x40000000)
834  ; FAST:   liveins: $vgpr0, $sgpr0, $sgpr1
835  ; FAST:   [[COPY:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
836  ; FAST:   [[COPY1:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
837  ; FAST:   [[COPY2:%[0-9]+]]:sgpr(s32) = COPY $sgpr1
838  ; FAST:   [[C:%[0-9]+]]:sgpr(s32) = G_CONSTANT i32 0
839  ; FAST:   [[COPY3:%[0-9]+]]:vgpr(s32) = COPY [[C]](s32)
840  ; FAST:   [[ICMP:%[0-9]+]]:vcc(s1) = G_ICMP intpred(eq), [[COPY]](s32), [[COPY3]]
841  ; FAST:   [[ICMP1:%[0-9]+]]:sgpr(s32) = G_ICMP intpred(eq), [[COPY2]](s32), [[C]]
842  ; FAST:   [[TRUNC:%[0-9]+]]:sgpr(s1) = G_TRUNC [[ICMP1]](s32)
843  ; FAST:   [[ZEXT:%[0-9]+]]:sgpr(s32) = G_ZEXT [[TRUNC]](s1)
844  ; FAST:   G_BRCOND [[ZEXT]](s32), %bb.1
845  ; FAST:   G_BR %bb.2
846  ; FAST: bb.1:
847  ; FAST:   successors: %bb.2(0x80000000)
848  ; FAST:   [[TRUNC1:%[0-9]+]]:sgpr(s1) = G_TRUNC [[COPY1]](s32)
849  ; FAST:   [[COPY4:%[0-9]+]]:vcc(s1) = COPY [[TRUNC1]](s1)
850  ; FAST:   G_BR %bb.2
851  ; FAST: bb.2:
852  ; FAST:   [[PHI:%[0-9]+]]:vcc(s1) = G_PHI [[ICMP]](s1), %bb.0, [[COPY4]](s1), %bb.1
853  ; FAST:   [[COPY5:%[0-9]+]]:vgpr(s32) = COPY [[C]](s32)
854  ; FAST:   [[SELECT:%[0-9]+]]:vgpr(s32) = G_SELECT [[PHI]](s1), [[COPY5]], [[COPY]]
855  ; FAST:   S_SETPC_B64 undef $sgpr30_sgpr31, implicit [[SELECT]](s32)
856  ; GREEDY-LABEL: name: phi_s1_vcc_s_sbranch
857  ; GREEDY: bb.0:
858  ; GREEDY:   successors: %bb.1(0x40000000), %bb.2(0x40000000)
859  ; GREEDY:   liveins: $vgpr0, $sgpr0, $sgpr1
860  ; GREEDY:   [[COPY:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
861  ; GREEDY:   [[COPY1:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
862  ; GREEDY:   [[COPY2:%[0-9]+]]:sgpr(s32) = COPY $sgpr1
863  ; GREEDY:   [[C:%[0-9]+]]:sgpr(s32) = G_CONSTANT i32 0
864  ; GREEDY:   [[COPY3:%[0-9]+]]:vgpr(s32) = COPY [[C]](s32)
865  ; GREEDY:   [[ICMP:%[0-9]+]]:vcc(s1) = G_ICMP intpred(eq), [[COPY]](s32), [[COPY3]]
866  ; GREEDY:   [[ICMP1:%[0-9]+]]:sgpr(s32) = G_ICMP intpred(eq), [[COPY2]](s32), [[C]]
867  ; GREEDY:   [[TRUNC:%[0-9]+]]:sgpr(s1) = G_TRUNC [[ICMP1]](s32)
868  ; GREEDY:   [[ZEXT:%[0-9]+]]:sgpr(s32) = G_ZEXT [[TRUNC]](s1)
869  ; GREEDY:   G_BRCOND [[ZEXT]](s32), %bb.1
870  ; GREEDY:   G_BR %bb.2
871  ; GREEDY: bb.1:
872  ; GREEDY:   successors: %bb.2(0x80000000)
873  ; GREEDY:   [[TRUNC1:%[0-9]+]]:sgpr(s1) = G_TRUNC [[COPY1]](s32)
874  ; GREEDY:   [[COPY4:%[0-9]+]]:vcc(s1) = COPY [[TRUNC1]](s1)
875  ; GREEDY:   G_BR %bb.2
876  ; GREEDY: bb.2:
877  ; GREEDY:   [[PHI:%[0-9]+]]:vcc(s1) = G_PHI [[ICMP]](s1), %bb.0, [[COPY4]](s1), %bb.1
878  ; GREEDY:   [[COPY5:%[0-9]+]]:vgpr(s32) = COPY [[C]](s32)
879  ; GREEDY:   [[SELECT:%[0-9]+]]:vgpr(s32) = G_SELECT [[PHI]](s1), [[COPY5]], [[COPY]]
880  ; GREEDY:   S_SETPC_B64 undef $sgpr30_sgpr31, implicit [[SELECT]](s32)
881  bb.0:
882    successors: %bb.1, %bb.2
883    liveins: $vgpr0, $sgpr0, $sgpr1
884
885    %0:_(s32) = COPY $vgpr0
886    %1:_(s32) = COPY $sgpr0
887    %2:_(s32) = COPY $sgpr1
888    %3:_(s32) = G_CONSTANT i32 0
889    %4:_(s1) = G_ICMP intpred(eq), %0, %3
890    %5:_(s1) = G_ICMP intpred(eq), %2, %3
891    G_BRCOND %5, %bb.1
892    G_BR %bb.2
893
894  bb.1:
895    successors: %bb.2
896
897    %6:_(s1) = G_TRUNC %1
898    G_BR %bb.2
899
900  bb.2:
901    %7:_(s1) = G_PHI %4, %bb.0, %6, %bb.1
902    %8:_(s32) = G_SELECT %7, %3, %0
903    S_SETPC_B64 undef $sgpr30_sgpr31, implicit %8
904
905...
906
907---
908name: phi_s1_s_vcc_sbranch
909legalized: true
910tracksRegLiveness: true
911
912body: |
913  ; FAST-LABEL: name: phi_s1_s_vcc_sbranch
914  ; FAST: bb.0:
915  ; FAST:   successors: %bb.1(0x40000000), %bb.2(0x40000000)
916  ; FAST:   liveins: $vgpr0, $sgpr0, $sgpr1
917  ; FAST:   [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
918  ; FAST:   [[COPY1:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
919  ; FAST:   [[COPY2:%[0-9]+]]:sgpr(s32) = COPY $sgpr1
920  ; FAST:   [[C:%[0-9]+]]:sgpr(s32) = G_CONSTANT i32 0
921  ; FAST:   [[TRUNC:%[0-9]+]]:sgpr(s1) = G_TRUNC [[COPY]](s32)
922  ; FAST:   [[ICMP:%[0-9]+]]:sgpr(s32) = G_ICMP intpred(eq), [[COPY2]](s32), [[C]]
923  ; FAST:   [[TRUNC1:%[0-9]+]]:sgpr(s1) = G_TRUNC [[ICMP]](s32)
924  ; FAST:   [[ZEXT:%[0-9]+]]:sgpr(s32) = G_ZEXT [[TRUNC1]](s1)
925  ; FAST:   [[COPY3:%[0-9]+]]:vcc(s1) = COPY [[TRUNC]](s1)
926  ; FAST:   G_BRCOND [[ZEXT]](s32), %bb.1
927  ; FAST:   G_BR %bb.2
928  ; FAST: bb.1:
929  ; FAST:   successors: %bb.2(0x80000000)
930  ; FAST:   [[COPY4:%[0-9]+]]:vgpr(s32) = COPY [[C]](s32)
931  ; FAST:   [[ICMP1:%[0-9]+]]:vcc(s1) = G_ICMP intpred(eq), [[COPY1]](s32), [[COPY4]]
932  ; FAST:   G_BR %bb.2
933  ; FAST: bb.2:
934  ; FAST:   [[PHI:%[0-9]+]]:vcc(s1) = G_PHI [[COPY3]](s1), %bb.0, [[ICMP1]](s1), %bb.1
935  ; FAST:   [[COPY5:%[0-9]+]]:vgpr(s32) = COPY [[C]](s32)
936  ; FAST:   [[COPY6:%[0-9]+]]:vgpr(s32) = COPY [[COPY]](s32)
937  ; FAST:   [[SELECT:%[0-9]+]]:vgpr(s32) = G_SELECT [[PHI]](s1), [[COPY5]], [[COPY6]]
938  ; FAST:   S_SETPC_B64 undef $sgpr30_sgpr31, implicit [[SELECT]](s32)
939  ; GREEDY-LABEL: name: phi_s1_s_vcc_sbranch
940  ; GREEDY: bb.0:
941  ; GREEDY:   successors: %bb.1(0x40000000), %bb.2(0x40000000)
942  ; GREEDY:   liveins: $vgpr0, $sgpr0, $sgpr1
943  ; GREEDY:   [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
944  ; GREEDY:   [[COPY1:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
945  ; GREEDY:   [[COPY2:%[0-9]+]]:sgpr(s32) = COPY $sgpr1
946  ; GREEDY:   [[C:%[0-9]+]]:sgpr(s32) = G_CONSTANT i32 0
947  ; GREEDY:   [[TRUNC:%[0-9]+]]:sgpr(s1) = G_TRUNC [[COPY]](s32)
948  ; GREEDY:   [[ICMP:%[0-9]+]]:sgpr(s32) = G_ICMP intpred(eq), [[COPY2]](s32), [[C]]
949  ; GREEDY:   [[TRUNC1:%[0-9]+]]:sgpr(s1) = G_TRUNC [[ICMP]](s32)
950  ; GREEDY:   [[ZEXT:%[0-9]+]]:sgpr(s32) = G_ZEXT [[TRUNC1]](s1)
951  ; GREEDY:   [[COPY3:%[0-9]+]]:vcc(s1) = COPY [[TRUNC]](s1)
952  ; GREEDY:   G_BRCOND [[ZEXT]](s32), %bb.1
953  ; GREEDY:   G_BR %bb.2
954  ; GREEDY: bb.1:
955  ; GREEDY:   successors: %bb.2(0x80000000)
956  ; GREEDY:   [[COPY4:%[0-9]+]]:vgpr(s32) = COPY [[C]](s32)
957  ; GREEDY:   [[ICMP1:%[0-9]+]]:vcc(s1) = G_ICMP intpred(eq), [[COPY1]](s32), [[COPY4]]
958  ; GREEDY:   G_BR %bb.2
959  ; GREEDY: bb.2:
960  ; GREEDY:   [[PHI:%[0-9]+]]:vcc(s1) = G_PHI [[COPY3]](s1), %bb.0, [[ICMP1]](s1), %bb.1
961  ; GREEDY:   [[COPY5:%[0-9]+]]:vgpr(s32) = COPY [[C]](s32)
962  ; GREEDY:   [[COPY6:%[0-9]+]]:vgpr(s32) = COPY [[COPY]](s32)
963  ; GREEDY:   [[SELECT:%[0-9]+]]:vgpr(s32) = G_SELECT [[PHI]](s1), [[COPY5]], [[COPY6]]
964  ; GREEDY:   S_SETPC_B64 undef $sgpr30_sgpr31, implicit [[SELECT]](s32)
965  bb.0:
966    successors: %bb.1, %bb.2
967    liveins: $vgpr0, $sgpr0, $sgpr1
968
969    %0:_(s32) = COPY $sgpr0
970    %1:_(s32) = COPY $vgpr0
971    %2:_(s32) = COPY $sgpr1
972    %3:_(s32) = G_CONSTANT i32 0
973    %4:_(s1) = G_TRUNC %0
974    %5:_(s1) = G_ICMP intpred(eq), %2, %3
975    G_BRCOND %5, %bb.1
976    G_BR %bb.2
977
978  bb.1:
979    successors: %bb.2
980
981    %6:_(s1) = G_ICMP intpred(eq), %1, %3
982    G_BR %bb.2
983
984  bb.2:
985    %7:_(s1) = G_PHI %4, %bb.0, %6, %bb.1
986    %8:_(s32) = G_SELECT %7, %3, %0
987    S_SETPC_B64 undef $sgpr30_sgpr31, implicit %8
988
989...
990
991---
992name: phi_s1_vcc_v_sbranch
993legalized: true
994tracksRegLiveness: true
995
996body: |
997  ; FAST-LABEL: name: phi_s1_vcc_v_sbranch
998  ; FAST: bb.0:
999  ; FAST:   successors: %bb.1(0x40000000), %bb.2(0x40000000)
1000  ; FAST:   liveins: $vgpr0, $vgpr1, $sgpr0
1001  ; FAST:   [[COPY:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
1002  ; FAST:   [[COPY1:%[0-9]+]]:vgpr(s32) = COPY $vgpr1
1003  ; FAST:   [[COPY2:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
1004  ; FAST:   [[C:%[0-9]+]]:sgpr(s32) = G_CONSTANT i32 0
1005  ; FAST:   [[COPY3:%[0-9]+]]:vgpr(s32) = COPY [[C]](s32)
1006  ; FAST:   [[ICMP:%[0-9]+]]:vcc(s1) = G_ICMP intpred(eq), [[COPY]](s32), [[COPY3]]
1007  ; FAST:   [[ICMP1:%[0-9]+]]:sgpr(s32) = G_ICMP intpred(eq), [[COPY2]](s32), [[C]]
1008  ; FAST:   [[TRUNC:%[0-9]+]]:sgpr(s1) = G_TRUNC [[ICMP1]](s32)
1009  ; FAST:   [[ZEXT:%[0-9]+]]:sgpr(s32) = G_ZEXT [[TRUNC]](s1)
1010  ; FAST:   [[C1:%[0-9]+]]:vgpr(s32) = G_CONSTANT i32 1
1011  ; FAST:   [[C2:%[0-9]+]]:vgpr(s32) = G_CONSTANT i32 0
1012  ; FAST:   [[SELECT:%[0-9]+]]:vgpr(s32) = G_SELECT [[ICMP]](s1), [[C1]], [[C2]]
1013  ; FAST:   G_BRCOND [[ZEXT]](s32), %bb.1
1014  ; FAST:   G_BR %bb.2
1015  ; FAST: bb.1:
1016  ; FAST:   successors: %bb.2(0x80000000)
1017  ; FAST:   [[TRUNC1:%[0-9]+]]:vgpr(s1) = G_TRUNC [[COPY1]](s32)
1018  ; FAST:   [[ANYEXT:%[0-9]+]]:vgpr(s32) = G_ANYEXT [[TRUNC1]](s1)
1019  ; FAST:   G_BR %bb.2
1020  ; FAST: bb.2:
1021  ; FAST:   [[PHI:%[0-9]+]]:vgpr(s32) = G_PHI [[SELECT]](s32), %bb.0, [[ANYEXT]](s32), %bb.1
1022  ; FAST:   [[TRUNC2:%[0-9]+]]:vgpr(s1) = G_TRUNC [[PHI]](s32)
1023  ; FAST:   [[COPY4:%[0-9]+]]:vcc(s1) = COPY [[TRUNC2]](s1)
1024  ; FAST:   [[COPY5:%[0-9]+]]:vgpr(s32) = COPY [[C]](s32)
1025  ; FAST:   [[SELECT1:%[0-9]+]]:vgpr(s32) = G_SELECT [[COPY4]](s1), [[COPY5]], [[COPY]]
1026  ; FAST:   S_SETPC_B64 undef $sgpr30_sgpr31, implicit [[SELECT1]](s32)
1027  ; GREEDY-LABEL: name: phi_s1_vcc_v_sbranch
1028  ; GREEDY: bb.0:
1029  ; GREEDY:   successors: %bb.1(0x40000000), %bb.2(0x40000000)
1030  ; GREEDY:   liveins: $vgpr0, $vgpr1, $sgpr0
1031  ; GREEDY:   [[COPY:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
1032  ; GREEDY:   [[COPY1:%[0-9]+]]:vgpr(s32) = COPY $vgpr1
1033  ; GREEDY:   [[COPY2:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
1034  ; GREEDY:   [[C:%[0-9]+]]:sgpr(s32) = G_CONSTANT i32 0
1035  ; GREEDY:   [[COPY3:%[0-9]+]]:vgpr(s32) = COPY [[C]](s32)
1036  ; GREEDY:   [[ICMP:%[0-9]+]]:vcc(s1) = G_ICMP intpred(eq), [[COPY]](s32), [[COPY3]]
1037  ; GREEDY:   [[ICMP1:%[0-9]+]]:sgpr(s32) = G_ICMP intpred(eq), [[COPY2]](s32), [[C]]
1038  ; GREEDY:   [[TRUNC:%[0-9]+]]:sgpr(s1) = G_TRUNC [[ICMP1]](s32)
1039  ; GREEDY:   [[ZEXT:%[0-9]+]]:sgpr(s32) = G_ZEXT [[TRUNC]](s1)
1040  ; GREEDY:   [[C1:%[0-9]+]]:vgpr(s32) = G_CONSTANT i32 1
1041  ; GREEDY:   [[C2:%[0-9]+]]:vgpr(s32) = G_CONSTANT i32 0
1042  ; GREEDY:   [[SELECT:%[0-9]+]]:vgpr(s32) = G_SELECT [[ICMP]](s1), [[C1]], [[C2]]
1043  ; GREEDY:   G_BRCOND [[ZEXT]](s32), %bb.1
1044  ; GREEDY:   G_BR %bb.2
1045  ; GREEDY: bb.1:
1046  ; GREEDY:   successors: %bb.2(0x80000000)
1047  ; GREEDY:   [[TRUNC1:%[0-9]+]]:vgpr(s1) = G_TRUNC [[COPY1]](s32)
1048  ; GREEDY:   [[ANYEXT:%[0-9]+]]:vgpr(s32) = G_ANYEXT [[TRUNC1]](s1)
1049  ; GREEDY:   G_BR %bb.2
1050  ; GREEDY: bb.2:
1051  ; GREEDY:   [[PHI:%[0-9]+]]:vgpr(s32) = G_PHI [[SELECT]](s32), %bb.0, [[ANYEXT]](s32), %bb.1
1052  ; GREEDY:   [[TRUNC2:%[0-9]+]]:vgpr(s1) = G_TRUNC [[PHI]](s32)
1053  ; GREEDY:   [[COPY4:%[0-9]+]]:vcc(s1) = COPY [[TRUNC2]](s1)
1054  ; GREEDY:   [[COPY5:%[0-9]+]]:vgpr(s32) = COPY [[C]](s32)
1055  ; GREEDY:   [[SELECT1:%[0-9]+]]:vgpr(s32) = G_SELECT [[COPY4]](s1), [[COPY5]], [[COPY]]
1056  ; GREEDY:   S_SETPC_B64 undef $sgpr30_sgpr31, implicit [[SELECT1]](s32)
1057  bb.0:
1058    successors: %bb.1, %bb.2
1059    liveins: $vgpr0, $vgpr1, $sgpr0
1060
1061    %0:_(s32) = COPY $vgpr0
1062    %1:_(s32) = COPY $vgpr1
1063    %2:_(s32) = COPY $sgpr0
1064    %3:_(s32) = G_CONSTANT i32 0
1065    %4:_(s1) = G_ICMP intpred(eq), %0, %3
1066    %5:_(s1) = G_ICMP intpred(eq), %2, %3
1067    G_BRCOND %5, %bb.1
1068    G_BR %bb.2
1069
1070  bb.1:
1071    successors: %bb.2
1072
1073    %6:_(s1) = G_TRUNC %1
1074    G_BR %bb.2
1075
1076  bb.2:
1077    %7:_(s1) = G_PHI %4, %bb.0, %6, %bb.1
1078    %8:_(s32) = G_SELECT %7, %3, %0
1079    S_SETPC_B64 undef $sgpr30_sgpr31, implicit %8
1080
1081...
1082
1083---
1084name: phi_s1_v_vcc_sbranch
1085legalized: true
1086tracksRegLiveness: true
1087
1088body: |
1089  ; FAST-LABEL: name: phi_s1_v_vcc_sbranch
1090  ; FAST: bb.0:
1091  ; FAST:   successors: %bb.1(0x40000000), %bb.2(0x40000000)
1092  ; FAST:   liveins: $vgpr0, $vgpr1, $sgpr0
1093  ; FAST:   [[COPY:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
1094  ; FAST:   [[COPY1:%[0-9]+]]:vgpr(s32) = COPY $vgpr1
1095  ; FAST:   [[COPY2:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
1096  ; FAST:   [[C:%[0-9]+]]:sgpr(s32) = G_CONSTANT i32 0
1097  ; FAST:   [[TRUNC:%[0-9]+]]:vgpr(s1) = G_TRUNC [[COPY]](s32)
1098  ; FAST:   [[ICMP:%[0-9]+]]:sgpr(s32) = G_ICMP intpred(eq), [[COPY2]](s32), [[C]]
1099  ; FAST:   [[TRUNC1:%[0-9]+]]:sgpr(s1) = G_TRUNC [[ICMP]](s32)
1100  ; FAST:   [[ZEXT:%[0-9]+]]:sgpr(s32) = G_ZEXT [[TRUNC1]](s1)
1101  ; FAST:   [[ANYEXT:%[0-9]+]]:vgpr(s32) = G_ANYEXT [[TRUNC]](s1)
1102  ; FAST:   G_BRCOND [[ZEXT]](s32), %bb.1
1103  ; FAST:   G_BR %bb.2
1104  ; FAST: bb.1:
1105  ; FAST:   successors: %bb.2(0x80000000)
1106  ; FAST:   [[COPY3:%[0-9]+]]:vgpr(s32) = COPY [[C]](s32)
1107  ; FAST:   [[ICMP1:%[0-9]+]]:vcc(s1) = G_ICMP intpred(eq), [[COPY1]](s32), [[COPY3]]
1108  ; FAST:   [[C1:%[0-9]+]]:vgpr(s32) = G_CONSTANT i32 1
1109  ; FAST:   [[C2:%[0-9]+]]:vgpr(s32) = G_CONSTANT i32 0
1110  ; FAST:   [[SELECT:%[0-9]+]]:vgpr(s32) = G_SELECT [[ICMP1]](s1), [[C1]], [[C2]]
1111  ; FAST:   G_BR %bb.2
1112  ; FAST: bb.2:
1113  ; FAST:   [[PHI:%[0-9]+]]:vgpr(s32) = G_PHI [[ANYEXT]](s32), %bb.0, [[SELECT]](s32), %bb.1
1114  ; FAST:   [[TRUNC2:%[0-9]+]]:vgpr(s1) = G_TRUNC [[PHI]](s32)
1115  ; FAST:   [[COPY4:%[0-9]+]]:vcc(s1) = COPY [[TRUNC2]](s1)
1116  ; FAST:   [[COPY5:%[0-9]+]]:vgpr(s32) = COPY [[C]](s32)
1117  ; FAST:   [[SELECT1:%[0-9]+]]:vgpr(s32) = G_SELECT [[COPY4]](s1), [[COPY5]], [[COPY]]
1118  ; FAST:   S_SETPC_B64 undef $sgpr30_sgpr31, implicit [[SELECT1]](s32)
1119  ; GREEDY-LABEL: name: phi_s1_v_vcc_sbranch
1120  ; GREEDY: bb.0:
1121  ; GREEDY:   successors: %bb.1(0x40000000), %bb.2(0x40000000)
1122  ; GREEDY:   liveins: $vgpr0, $vgpr1, $sgpr0
1123  ; GREEDY:   [[COPY:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
1124  ; GREEDY:   [[COPY1:%[0-9]+]]:vgpr(s32) = COPY $vgpr1
1125  ; GREEDY:   [[COPY2:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
1126  ; GREEDY:   [[C:%[0-9]+]]:sgpr(s32) = G_CONSTANT i32 0
1127  ; GREEDY:   [[TRUNC:%[0-9]+]]:vgpr(s1) = G_TRUNC [[COPY]](s32)
1128  ; GREEDY:   [[ICMP:%[0-9]+]]:sgpr(s32) = G_ICMP intpred(eq), [[COPY2]](s32), [[C]]
1129  ; GREEDY:   [[TRUNC1:%[0-9]+]]:sgpr(s1) = G_TRUNC [[ICMP]](s32)
1130  ; GREEDY:   [[ZEXT:%[0-9]+]]:sgpr(s32) = G_ZEXT [[TRUNC1]](s1)
1131  ; GREEDY:   [[ANYEXT:%[0-9]+]]:vgpr(s32) = G_ANYEXT [[TRUNC]](s1)
1132  ; GREEDY:   G_BRCOND [[ZEXT]](s32), %bb.1
1133  ; GREEDY:   G_BR %bb.2
1134  ; GREEDY: bb.1:
1135  ; GREEDY:   successors: %bb.2(0x80000000)
1136  ; GREEDY:   [[COPY3:%[0-9]+]]:vgpr(s32) = COPY [[C]](s32)
1137  ; GREEDY:   [[ICMP1:%[0-9]+]]:vcc(s1) = G_ICMP intpred(eq), [[COPY1]](s32), [[COPY3]]
1138  ; GREEDY:   [[C1:%[0-9]+]]:vgpr(s32) = G_CONSTANT i32 1
1139  ; GREEDY:   [[C2:%[0-9]+]]:vgpr(s32) = G_CONSTANT i32 0
1140  ; GREEDY:   [[SELECT:%[0-9]+]]:vgpr(s32) = G_SELECT [[ICMP1]](s1), [[C1]], [[C2]]
1141  ; GREEDY:   G_BR %bb.2
1142  ; GREEDY: bb.2:
1143  ; GREEDY:   [[PHI:%[0-9]+]]:vgpr(s32) = G_PHI [[ANYEXT]](s32), %bb.0, [[SELECT]](s32), %bb.1
1144  ; GREEDY:   [[TRUNC2:%[0-9]+]]:vgpr(s1) = G_TRUNC [[PHI]](s32)
1145  ; GREEDY:   [[COPY4:%[0-9]+]]:vcc(s1) = COPY [[TRUNC2]](s1)
1146  ; GREEDY:   [[COPY5:%[0-9]+]]:vgpr(s32) = COPY [[C]](s32)
1147  ; GREEDY:   [[SELECT1:%[0-9]+]]:vgpr(s32) = G_SELECT [[COPY4]](s1), [[COPY5]], [[COPY]]
1148  ; GREEDY:   S_SETPC_B64 undef $sgpr30_sgpr31, implicit [[SELECT1]](s32)
1149  bb.0:
1150    successors: %bb.1, %bb.2
1151    liveins: $vgpr0, $vgpr1, $sgpr0
1152
1153    %0:_(s32) = COPY $vgpr0
1154    %1:_(s32) = COPY $vgpr1
1155    %2:_(s32) = COPY $sgpr0
1156    %3:_(s32) = G_CONSTANT i32 0
1157    %4:_(s1) = G_TRUNC %0
1158    %5:_(s1) = G_ICMP intpred(eq), %2, %3
1159    G_BRCOND %5, %bb.1
1160    G_BR %bb.2
1161
1162  bb.1:
1163    successors: %bb.2
1164
1165    %6:_(s1) = G_ICMP intpred(eq), %1, %3
1166    G_BR %bb.2
1167
1168  bb.2:
1169    %7:_(s1) = G_PHI %4, %bb.0, %6, %bb.1
1170    %8:_(s32) = G_SELECT %7, %3, %0
1171    S_SETPC_B64 undef $sgpr30_sgpr31, implicit %8
1172
1173...
1174
1175---
1176name: phi_s1_v_s_sbranch
1177legalized: true
1178tracksRegLiveness: true
1179
1180body: |
1181  ; FAST-LABEL: name: phi_s1_v_s_sbranch
1182  ; FAST: bb.0:
1183  ; FAST:   successors: %bb.1(0x40000000), %bb.2(0x40000000)
1184  ; FAST:   liveins: $vgpr0, $sgpr0, $sgpr1
1185  ; FAST:   [[COPY:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
1186  ; FAST:   [[COPY1:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
1187  ; FAST:   [[COPY2:%[0-9]+]]:sgpr(s32) = COPY $sgpr1
1188  ; FAST:   [[C:%[0-9]+]]:sgpr(s32) = G_CONSTANT i32 0
1189  ; FAST:   [[TRUNC:%[0-9]+]]:vgpr(s1) = G_TRUNC [[COPY]](s32)
1190  ; FAST:   [[ICMP:%[0-9]+]]:sgpr(s32) = G_ICMP intpred(eq), [[COPY2]](s32), [[C]]
1191  ; FAST:   [[TRUNC1:%[0-9]+]]:sgpr(s1) = G_TRUNC [[ICMP]](s32)
1192  ; FAST:   [[ZEXT:%[0-9]+]]:sgpr(s32) = G_ZEXT [[TRUNC1]](s1)
1193  ; FAST:   [[ANYEXT:%[0-9]+]]:vgpr(s32) = G_ANYEXT [[TRUNC]](s1)
1194  ; FAST:   G_BRCOND [[ZEXT]](s32), %bb.1
1195  ; FAST:   G_BR %bb.2
1196  ; FAST: bb.1:
1197  ; FAST:   successors: %bb.2(0x80000000)
1198  ; FAST:   [[TRUNC2:%[0-9]+]]:sgpr(s1) = G_TRUNC [[COPY1]](s32)
1199  ; FAST:   [[ANYEXT1:%[0-9]+]]:vgpr(s32) = G_ANYEXT [[TRUNC2]](s1)
1200  ; FAST:   G_BR %bb.2
1201  ; FAST: bb.2:
1202  ; FAST:   [[PHI:%[0-9]+]]:vgpr(s32) = G_PHI [[ANYEXT]](s32), %bb.0, [[ANYEXT1]](s32), %bb.1
1203  ; FAST:   [[TRUNC3:%[0-9]+]]:vgpr(s1) = G_TRUNC [[PHI]](s32)
1204  ; FAST:   [[COPY3:%[0-9]+]]:vcc(s1) = COPY [[TRUNC3]](s1)
1205  ; FAST:   [[COPY4:%[0-9]+]]:vgpr(s32) = COPY [[C]](s32)
1206  ; FAST:   [[SELECT:%[0-9]+]]:vgpr(s32) = G_SELECT [[COPY3]](s1), [[COPY4]], [[COPY]]
1207  ; FAST:   S_SETPC_B64 undef $sgpr30_sgpr31, implicit [[SELECT]](s32)
1208  ; GREEDY-LABEL: name: phi_s1_v_s_sbranch
1209  ; GREEDY: bb.0:
1210  ; GREEDY:   successors: %bb.1(0x40000000), %bb.2(0x40000000)
1211  ; GREEDY:   liveins: $vgpr0, $sgpr0, $sgpr1
1212  ; GREEDY:   [[COPY:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
1213  ; GREEDY:   [[COPY1:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
1214  ; GREEDY:   [[COPY2:%[0-9]+]]:sgpr(s32) = COPY $sgpr1
1215  ; GREEDY:   [[C:%[0-9]+]]:sgpr(s32) = G_CONSTANT i32 0
1216  ; GREEDY:   [[TRUNC:%[0-9]+]]:vgpr(s1) = G_TRUNC [[COPY]](s32)
1217  ; GREEDY:   [[ICMP:%[0-9]+]]:sgpr(s32) = G_ICMP intpred(eq), [[COPY2]](s32), [[C]]
1218  ; GREEDY:   [[TRUNC1:%[0-9]+]]:sgpr(s1) = G_TRUNC [[ICMP]](s32)
1219  ; GREEDY:   [[ZEXT:%[0-9]+]]:sgpr(s32) = G_ZEXT [[TRUNC1]](s1)
1220  ; GREEDY:   [[ANYEXT:%[0-9]+]]:vgpr(s32) = G_ANYEXT [[TRUNC]](s1)
1221  ; GREEDY:   G_BRCOND [[ZEXT]](s32), %bb.1
1222  ; GREEDY:   G_BR %bb.2
1223  ; GREEDY: bb.1:
1224  ; GREEDY:   successors: %bb.2(0x80000000)
1225  ; GREEDY:   [[TRUNC2:%[0-9]+]]:sgpr(s1) = G_TRUNC [[COPY1]](s32)
1226  ; GREEDY:   [[ANYEXT1:%[0-9]+]]:vgpr(s32) = G_ANYEXT [[TRUNC2]](s1)
1227  ; GREEDY:   G_BR %bb.2
1228  ; GREEDY: bb.2:
1229  ; GREEDY:   [[PHI:%[0-9]+]]:vgpr(s32) = G_PHI [[ANYEXT]](s32), %bb.0, [[ANYEXT1]](s32), %bb.1
1230  ; GREEDY:   [[TRUNC3:%[0-9]+]]:vgpr(s1) = G_TRUNC [[PHI]](s32)
1231  ; GREEDY:   [[COPY3:%[0-9]+]]:vcc(s1) = COPY [[TRUNC3]](s1)
1232  ; GREEDY:   [[COPY4:%[0-9]+]]:vgpr(s32) = COPY [[C]](s32)
1233  ; GREEDY:   [[SELECT:%[0-9]+]]:vgpr(s32) = G_SELECT [[COPY3]](s1), [[COPY4]], [[COPY]]
1234  ; GREEDY:   S_SETPC_B64 undef $sgpr30_sgpr31, implicit [[SELECT]](s32)
1235  bb.0:
1236    successors: %bb.1, %bb.2
1237    liveins: $vgpr0, $sgpr0, $sgpr1
1238
1239    %0:_(s32) = COPY $vgpr0
1240    %1:_(s32) = COPY $sgpr0
1241    %2:_(s32) = COPY $sgpr1
1242    %3:_(s32) = G_CONSTANT i32 0
1243    %4:_(s1) = G_TRUNC %0
1244    %5:_(s1) = G_ICMP intpred(eq), %2, %3
1245    G_BRCOND %5, %bb.1
1246    G_BR %bb.2
1247
1248  bb.1:
1249    successors: %bb.2
1250
1251    %6:_(s1) = G_TRUNC %1
1252    G_BR %bb.2
1253
1254  bb.2:
1255    %7:_(s1) = G_PHI %4, %bb.0, %6, %bb.1
1256    %8:_(s32) = G_SELECT %7, %3, %0
1257    S_SETPC_B64 undef $sgpr30_sgpr31, implicit %8
1258
1259...
1260
1261---
1262name: phi_s1_s_v_sbranch
1263legalized: true
1264tracksRegLiveness: true
1265
1266body: |
1267  ; FAST-LABEL: name: phi_s1_s_v_sbranch
1268  ; FAST: bb.0:
1269  ; FAST:   successors: %bb.1(0x40000000), %bb.2(0x40000000)
1270  ; FAST:   liveins: $vgpr0, $sgpr0, $sgpr1
1271  ; FAST:   [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
1272  ; FAST:   [[COPY1:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
1273  ; FAST:   [[COPY2:%[0-9]+]]:sgpr(s32) = COPY $sgpr1
1274  ; FAST:   [[C:%[0-9]+]]:sgpr(s32) = G_CONSTANT i32 0
1275  ; FAST:   [[TRUNC:%[0-9]+]]:sgpr(s1) = G_TRUNC [[COPY]](s32)
1276  ; FAST:   [[ICMP:%[0-9]+]]:sgpr(s32) = G_ICMP intpred(eq), [[COPY2]](s32), [[C]]
1277  ; FAST:   [[TRUNC1:%[0-9]+]]:sgpr(s1) = G_TRUNC [[ICMP]](s32)
1278  ; FAST:   [[ZEXT:%[0-9]+]]:sgpr(s32) = G_ZEXT [[TRUNC1]](s1)
1279  ; FAST:   [[ANYEXT:%[0-9]+]]:vgpr(s32) = G_ANYEXT [[TRUNC]](s1)
1280  ; FAST:   G_BRCOND [[ZEXT]](s32), %bb.1
1281  ; FAST:   G_BR %bb.2
1282  ; FAST: bb.1:
1283  ; FAST:   successors: %bb.2(0x80000000)
1284  ; FAST:   [[TRUNC2:%[0-9]+]]:vgpr(s1) = G_TRUNC [[COPY1]](s32)
1285  ; FAST:   [[ANYEXT1:%[0-9]+]]:vgpr(s32) = G_ANYEXT [[TRUNC2]](s1)
1286  ; FAST:   G_BR %bb.2
1287  ; FAST: bb.2:
1288  ; FAST:   [[PHI:%[0-9]+]]:vgpr(s32) = G_PHI [[ANYEXT]](s32), %bb.0, [[ANYEXT1]](s32), %bb.1
1289  ; FAST:   [[TRUNC3:%[0-9]+]]:vgpr(s1) = G_TRUNC [[PHI]](s32)
1290  ; FAST:   [[COPY3:%[0-9]+]]:vcc(s1) = COPY [[TRUNC3]](s1)
1291  ; FAST:   [[COPY4:%[0-9]+]]:vgpr(s32) = COPY [[C]](s32)
1292  ; FAST:   [[COPY5:%[0-9]+]]:vgpr(s32) = COPY [[COPY]](s32)
1293  ; FAST:   [[SELECT:%[0-9]+]]:vgpr(s32) = G_SELECT [[COPY3]](s1), [[COPY4]], [[COPY5]]
1294  ; FAST:   S_SETPC_B64 undef $sgpr30_sgpr31, implicit [[SELECT]](s32)
1295  ; GREEDY-LABEL: name: phi_s1_s_v_sbranch
1296  ; GREEDY: bb.0:
1297  ; GREEDY:   successors: %bb.1(0x40000000), %bb.2(0x40000000)
1298  ; GREEDY:   liveins: $vgpr0, $sgpr0, $sgpr1
1299  ; GREEDY:   [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
1300  ; GREEDY:   [[COPY1:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
1301  ; GREEDY:   [[COPY2:%[0-9]+]]:sgpr(s32) = COPY $sgpr1
1302  ; GREEDY:   [[C:%[0-9]+]]:sgpr(s32) = G_CONSTANT i32 0
1303  ; GREEDY:   [[TRUNC:%[0-9]+]]:sgpr(s1) = G_TRUNC [[COPY]](s32)
1304  ; GREEDY:   [[ICMP:%[0-9]+]]:sgpr(s32) = G_ICMP intpred(eq), [[COPY2]](s32), [[C]]
1305  ; GREEDY:   [[TRUNC1:%[0-9]+]]:sgpr(s1) = G_TRUNC [[ICMP]](s32)
1306  ; GREEDY:   [[ZEXT:%[0-9]+]]:sgpr(s32) = G_ZEXT [[TRUNC1]](s1)
1307  ; GREEDY:   [[ANYEXT:%[0-9]+]]:vgpr(s32) = G_ANYEXT [[TRUNC]](s1)
1308  ; GREEDY:   G_BRCOND [[ZEXT]](s32), %bb.1
1309  ; GREEDY:   G_BR %bb.2
1310  ; GREEDY: bb.1:
1311  ; GREEDY:   successors: %bb.2(0x80000000)
1312  ; GREEDY:   [[TRUNC2:%[0-9]+]]:vgpr(s1) = G_TRUNC [[COPY1]](s32)
1313  ; GREEDY:   [[ANYEXT1:%[0-9]+]]:vgpr(s32) = G_ANYEXT [[TRUNC2]](s1)
1314  ; GREEDY:   G_BR %bb.2
1315  ; GREEDY: bb.2:
1316  ; GREEDY:   [[PHI:%[0-9]+]]:vgpr(s32) = G_PHI [[ANYEXT]](s32), %bb.0, [[ANYEXT1]](s32), %bb.1
1317  ; GREEDY:   [[TRUNC3:%[0-9]+]]:vgpr(s1) = G_TRUNC [[PHI]](s32)
1318  ; GREEDY:   [[COPY3:%[0-9]+]]:vcc(s1) = COPY [[TRUNC3]](s1)
1319  ; GREEDY:   [[COPY4:%[0-9]+]]:vgpr(s32) = COPY [[C]](s32)
1320  ; GREEDY:   [[COPY5:%[0-9]+]]:vgpr(s32) = COPY [[COPY]](s32)
1321  ; GREEDY:   [[SELECT:%[0-9]+]]:vgpr(s32) = G_SELECT [[COPY3]](s1), [[COPY4]], [[COPY5]]
1322  ; GREEDY:   S_SETPC_B64 undef $sgpr30_sgpr31, implicit [[SELECT]](s32)
1323  bb.0:
1324    successors: %bb.1, %bb.2
1325    liveins: $vgpr0, $sgpr0, $sgpr1
1326
1327    %0:_(s32) = COPY $sgpr0
1328    %1:_(s32) = COPY $vgpr0
1329    %2:_(s32) = COPY $sgpr1
1330    %3:_(s32) = G_CONSTANT i32 0
1331    %4:_(s1) = G_TRUNC %0
1332    %5:_(s1) = G_ICMP intpred(eq), %2, %3
1333    G_BRCOND %5, %bb.1
1334    G_BR %bb.2
1335
1336  bb.1:
1337    successors: %bb.2
1338
1339    %6:_(s1) = G_TRUNC %1
1340    G_BR %bb.2
1341
1342  bb.2:
1343    %7:_(s1) = G_PHI %4, %bb.0, %6, %bb.1
1344    %8:_(s32) = G_SELECT %7, %3, %0
1345    S_SETPC_B64 undef $sgpr30_sgpr31, implicit %8
1346
1347...
1348
1349---
1350name: phi_s1_v_v_sbranch
1351legalized: true
1352tracksRegLiveness: true
1353
1354body: |
1355  ; FAST-LABEL: name: phi_s1_v_v_sbranch
1356  ; FAST: bb.0:
1357  ; FAST:   successors: %bb.1(0x40000000), %bb.2(0x40000000)
1358  ; FAST:   liveins: $vgpr0, $vgpr1, $sgpr0
1359  ; FAST:   [[COPY:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
1360  ; FAST:   [[COPY1:%[0-9]+]]:vgpr(s32) = COPY $vgpr1
1361  ; FAST:   [[COPY2:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
1362  ; FAST:   [[C:%[0-9]+]]:sgpr(s32) = G_CONSTANT i32 0
1363  ; FAST:   [[TRUNC:%[0-9]+]]:vgpr(s1) = G_TRUNC [[COPY]](s32)
1364  ; FAST:   [[ICMP:%[0-9]+]]:sgpr(s32) = G_ICMP intpred(eq), [[COPY2]](s32), [[C]]
1365  ; FAST:   [[TRUNC1:%[0-9]+]]:sgpr(s1) = G_TRUNC [[ICMP]](s32)
1366  ; FAST:   [[ZEXT:%[0-9]+]]:sgpr(s32) = G_ZEXT [[TRUNC1]](s1)
1367  ; FAST:   [[ANYEXT:%[0-9]+]]:vgpr(s32) = G_ANYEXT [[TRUNC]](s1)
1368  ; FAST:   G_BRCOND [[ZEXT]](s32), %bb.1
1369  ; FAST:   G_BR %bb.2
1370  ; FAST: bb.1:
1371  ; FAST:   successors: %bb.2(0x80000000)
1372  ; FAST:   [[TRUNC2:%[0-9]+]]:vgpr(s1) = G_TRUNC [[COPY1]](s32)
1373  ; FAST:   [[ANYEXT1:%[0-9]+]]:vgpr(s32) = G_ANYEXT [[TRUNC2]](s1)
1374  ; FAST:   G_BR %bb.2
1375  ; FAST: bb.2:
1376  ; FAST:   [[PHI:%[0-9]+]]:vgpr(s32) = G_PHI [[ANYEXT]](s32), %bb.0, [[ANYEXT1]](s32), %bb.1
1377  ; FAST:   [[TRUNC3:%[0-9]+]]:vgpr(s1) = G_TRUNC [[PHI]](s32)
1378  ; FAST:   [[COPY3:%[0-9]+]]:vcc(s1) = COPY [[TRUNC3]](s1)
1379  ; FAST:   [[COPY4:%[0-9]+]]:vgpr(s32) = COPY [[C]](s32)
1380  ; FAST:   [[SELECT:%[0-9]+]]:vgpr(s32) = G_SELECT [[COPY3]](s1), [[COPY4]], [[COPY]]
1381  ; FAST:   S_SETPC_B64 undef $sgpr30_sgpr31, implicit [[SELECT]](s32)
1382  ; GREEDY-LABEL: name: phi_s1_v_v_sbranch
1383  ; GREEDY: bb.0:
1384  ; GREEDY:   successors: %bb.1(0x40000000), %bb.2(0x40000000)
1385  ; GREEDY:   liveins: $vgpr0, $vgpr1, $sgpr0
1386  ; GREEDY:   [[COPY:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
1387  ; GREEDY:   [[COPY1:%[0-9]+]]:vgpr(s32) = COPY $vgpr1
1388  ; GREEDY:   [[COPY2:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
1389  ; GREEDY:   [[C:%[0-9]+]]:sgpr(s32) = G_CONSTANT i32 0
1390  ; GREEDY:   [[TRUNC:%[0-9]+]]:vgpr(s1) = G_TRUNC [[COPY]](s32)
1391  ; GREEDY:   [[ICMP:%[0-9]+]]:sgpr(s32) = G_ICMP intpred(eq), [[COPY2]](s32), [[C]]
1392  ; GREEDY:   [[TRUNC1:%[0-9]+]]:sgpr(s1) = G_TRUNC [[ICMP]](s32)
1393  ; GREEDY:   [[ZEXT:%[0-9]+]]:sgpr(s32) = G_ZEXT [[TRUNC1]](s1)
1394  ; GREEDY:   [[ANYEXT:%[0-9]+]]:vgpr(s32) = G_ANYEXT [[TRUNC]](s1)
1395  ; GREEDY:   G_BRCOND [[ZEXT]](s32), %bb.1
1396  ; GREEDY:   G_BR %bb.2
1397  ; GREEDY: bb.1:
1398  ; GREEDY:   successors: %bb.2(0x80000000)
1399  ; GREEDY:   [[TRUNC2:%[0-9]+]]:vgpr(s1) = G_TRUNC [[COPY1]](s32)
1400  ; GREEDY:   [[ANYEXT1:%[0-9]+]]:vgpr(s32) = G_ANYEXT [[TRUNC2]](s1)
1401  ; GREEDY:   G_BR %bb.2
1402  ; GREEDY: bb.2:
1403  ; GREEDY:   [[PHI:%[0-9]+]]:vgpr(s32) = G_PHI [[ANYEXT]](s32), %bb.0, [[ANYEXT1]](s32), %bb.1
1404  ; GREEDY:   [[TRUNC3:%[0-9]+]]:vgpr(s1) = G_TRUNC [[PHI]](s32)
1405  ; GREEDY:   [[COPY3:%[0-9]+]]:vcc(s1) = COPY [[TRUNC3]](s1)
1406  ; GREEDY:   [[COPY4:%[0-9]+]]:vgpr(s32) = COPY [[C]](s32)
1407  ; GREEDY:   [[SELECT:%[0-9]+]]:vgpr(s32) = G_SELECT [[COPY3]](s1), [[COPY4]], [[COPY]]
1408  ; GREEDY:   S_SETPC_B64 undef $sgpr30_sgpr31, implicit [[SELECT]](s32)
1409  bb.0:
1410    successors: %bb.1, %bb.2
1411    liveins: $vgpr0, $vgpr1, $sgpr0
1412
1413    %0:_(s32) = COPY $vgpr0
1414    %1:_(s32) = COPY $vgpr1
1415    %2:_(s32) = COPY $sgpr0
1416    %3:_(s32) = G_CONSTANT i32 0
1417    %4:_(s1) = G_TRUNC %0
1418    %5:_(s1) = G_ICMP intpred(eq), %2, %3
1419    G_BRCOND %5, %bb.1
1420    G_BR %bb.2
1421
1422  bb.1:
1423    successors: %bb.2
1424
1425    %6:_(s1) = G_TRUNC %1
1426    G_BR %bb.2
1427
1428  bb.2:
1429    %7:_(s1) = G_PHI %4, %bb.0, %6, %bb.1
1430    %8:_(s32) = G_SELECT %7, %3, %0
1431    S_SETPC_B64 undef $sgpr30_sgpr31, implicit %8
1432
1433...
1434
1435---
1436name: phi_s1_s_s_sbranch
1437legalized: true
1438tracksRegLiveness: true
1439
1440body: |
1441  ; FAST-LABEL: name: phi_s1_s_s_sbranch
1442  ; FAST: bb.0:
1443  ; FAST:   successors: %bb.1(0x40000000), %bb.2(0x40000000)
1444  ; FAST:   liveins: $sgpr0, $sgpr1, $sgpr2
1445  ; FAST:   [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
1446  ; FAST:   [[COPY1:%[0-9]+]]:sgpr(s32) = COPY $sgpr1
1447  ; FAST:   [[COPY2:%[0-9]+]]:sgpr(s32) = COPY $sgpr2
1448  ; FAST:   [[C:%[0-9]+]]:sgpr(s32) = G_CONSTANT i32 0
1449  ; FAST:   [[TRUNC:%[0-9]+]]:sgpr(s1) = G_TRUNC [[COPY]](s32)
1450  ; FAST:   [[ICMP:%[0-9]+]]:sgpr(s32) = G_ICMP intpred(eq), [[COPY2]](s32), [[C]]
1451  ; FAST:   [[TRUNC1:%[0-9]+]]:sgpr(s1) = G_TRUNC [[ICMP]](s32)
1452  ; FAST:   [[ZEXT:%[0-9]+]]:sgpr(s32) = G_ZEXT [[TRUNC1]](s1)
1453  ; FAST:   [[ANYEXT:%[0-9]+]]:sgpr(s32) = G_ANYEXT [[TRUNC]](s1)
1454  ; FAST:   G_BRCOND [[ZEXT]](s32), %bb.1
1455  ; FAST:   G_BR %bb.2
1456  ; FAST: bb.1:
1457  ; FAST:   successors: %bb.2(0x80000000)
1458  ; FAST:   [[TRUNC2:%[0-9]+]]:sgpr(s1) = G_TRUNC [[COPY1]](s32)
1459  ; FAST:   [[ANYEXT1:%[0-9]+]]:sgpr(s32) = G_ANYEXT [[TRUNC2]](s1)
1460  ; FAST:   G_BR %bb.2
1461  ; FAST: bb.2:
1462  ; FAST:   [[PHI:%[0-9]+]]:sgpr(s32) = G_PHI [[ANYEXT]](s32), %bb.0, [[ANYEXT1]](s32), %bb.1
1463  ; FAST:   [[TRUNC3:%[0-9]+]]:sgpr(s1) = G_TRUNC [[PHI]](s32)
1464  ; FAST:   [[ZEXT1:%[0-9]+]]:sgpr(s32) = G_ZEXT [[TRUNC3]](s1)
1465  ; FAST:   [[SELECT:%[0-9]+]]:sgpr(s32) = G_SELECT [[ZEXT1]](s32), [[C]], [[COPY]]
1466  ; FAST:   S_SETPC_B64 undef $sgpr30_sgpr31, implicit [[SELECT]](s32)
1467  ; GREEDY-LABEL: name: phi_s1_s_s_sbranch
1468  ; GREEDY: bb.0:
1469  ; GREEDY:   successors: %bb.1(0x40000000), %bb.2(0x40000000)
1470  ; GREEDY:   liveins: $sgpr0, $sgpr1, $sgpr2
1471  ; GREEDY:   [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
1472  ; GREEDY:   [[COPY1:%[0-9]+]]:sgpr(s32) = COPY $sgpr1
1473  ; GREEDY:   [[COPY2:%[0-9]+]]:sgpr(s32) = COPY $sgpr2
1474  ; GREEDY:   [[C:%[0-9]+]]:sgpr(s32) = G_CONSTANT i32 0
1475  ; GREEDY:   [[TRUNC:%[0-9]+]]:sgpr(s1) = G_TRUNC [[COPY]](s32)
1476  ; GREEDY:   [[ICMP:%[0-9]+]]:sgpr(s32) = G_ICMP intpred(eq), [[COPY2]](s32), [[C]]
1477  ; GREEDY:   [[TRUNC1:%[0-9]+]]:sgpr(s1) = G_TRUNC [[ICMP]](s32)
1478  ; GREEDY:   [[ZEXT:%[0-9]+]]:sgpr(s32) = G_ZEXT [[TRUNC1]](s1)
1479  ; GREEDY:   [[ANYEXT:%[0-9]+]]:sgpr(s32) = G_ANYEXT [[TRUNC]](s1)
1480  ; GREEDY:   G_BRCOND [[ZEXT]](s32), %bb.1
1481  ; GREEDY:   G_BR %bb.2
1482  ; GREEDY: bb.1:
1483  ; GREEDY:   successors: %bb.2(0x80000000)
1484  ; GREEDY:   [[TRUNC2:%[0-9]+]]:sgpr(s1) = G_TRUNC [[COPY1]](s32)
1485  ; GREEDY:   [[ANYEXT1:%[0-9]+]]:sgpr(s32) = G_ANYEXT [[TRUNC2]](s1)
1486  ; GREEDY:   G_BR %bb.2
1487  ; GREEDY: bb.2:
1488  ; GREEDY:   [[PHI:%[0-9]+]]:sgpr(s32) = G_PHI [[ANYEXT]](s32), %bb.0, [[ANYEXT1]](s32), %bb.1
1489  ; GREEDY:   [[TRUNC3:%[0-9]+]]:sgpr(s1) = G_TRUNC [[PHI]](s32)
1490  ; GREEDY:   [[ZEXT1:%[0-9]+]]:sgpr(s32) = G_ZEXT [[TRUNC3]](s1)
1491  ; GREEDY:   [[SELECT:%[0-9]+]]:sgpr(s32) = G_SELECT [[ZEXT1]](s32), [[C]], [[COPY]]
1492  ; GREEDY:   S_SETPC_B64 undef $sgpr30_sgpr31, implicit [[SELECT]](s32)
1493  bb.0:
1494    successors: %bb.1, %bb.2
1495    liveins: $sgpr0, $sgpr1, $sgpr2
1496
1497    %0:_(s32) = COPY $sgpr0
1498    %1:_(s32) = COPY $sgpr1
1499    %2:_(s32) = COPY $sgpr2
1500    %3:_(s32) = G_CONSTANT i32 0
1501    %4:_(s1) = G_TRUNC %0
1502    %5:_(s1) = G_ICMP intpred(eq), %2, %3
1503    G_BRCOND %5, %bb.1
1504    G_BR %bb.2
1505
1506  bb.1:
1507    successors: %bb.2
1508
1509    %6:_(s1) = G_TRUNC %1
1510    G_BR %bb.2
1511
1512  bb.2:
1513    %7:_(s1) = G_PHI %4, %bb.0, %6, %bb.1
1514    %8:_(s32) = G_SELECT %7, %3, %0
1515    S_SETPC_B64 undef $sgpr30_sgpr31, implicit %8
1516
1517...
1518
1519---
1520name: phi_s1_vcc_result_scc_scc_sbranch
1521legalized: true
1522tracksRegLiveness: true
1523
1524body: |
1525  ; FAST-LABEL: name: phi_s1_vcc_result_scc_scc_sbranch
1526  ; FAST: bb.0:
1527  ; FAST:   successors: %bb.1(0x40000000), %bb.2(0x40000000)
1528  ; FAST:   liveins: $sgpr0, $sgpr1, $sgpr2
1529  ; FAST:   [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
1530  ; FAST:   [[COPY1:%[0-9]+]]:sgpr(s32) = COPY $sgpr1
1531  ; FAST:   [[COPY2:%[0-9]+]]:sgpr(s32) = COPY $sgpr2
1532  ; FAST:   [[C:%[0-9]+]]:sgpr(s32) = G_CONSTANT i32 0
1533  ; FAST:   [[ICMP:%[0-9]+]]:sgpr(s32) = G_ICMP intpred(eq), [[COPY]](s32), [[C]]
1534  ; FAST:   [[TRUNC:%[0-9]+]]:sgpr(s1) = G_TRUNC [[ICMP]](s32)
1535  ; FAST:   [[ICMP1:%[0-9]+]]:sgpr(s32) = G_ICMP intpred(eq), [[COPY2]](s32), [[C]]
1536  ; FAST:   [[TRUNC1:%[0-9]+]]:sgpr(s1) = G_TRUNC [[ICMP1]](s32)
1537  ; FAST:   [[ZEXT:%[0-9]+]]:sgpr(s32) = G_ZEXT [[TRUNC1]](s1)
1538  ; FAST:   [[COPY3:%[0-9]+]]:vcc(s1) = COPY [[TRUNC]](s1)
1539  ; FAST:   G_BRCOND [[ZEXT]](s32), %bb.1
1540  ; FAST:   G_BR %bb.2
1541  ; FAST: bb.1:
1542  ; FAST:   successors: %bb.2(0x80000000)
1543  ; FAST:   [[ICMP2:%[0-9]+]]:sgpr(s32) = G_ICMP intpred(eq), [[COPY1]](s32), [[C]]
1544  ; FAST:   [[TRUNC2:%[0-9]+]]:sgpr(s1) = G_TRUNC [[ICMP2]](s32)
1545  ; FAST:   [[COPY4:%[0-9]+]]:vcc(s1) = COPY [[TRUNC2]](s1)
1546  ; FAST:   G_BR %bb.2
1547  ; FAST: bb.2:
1548  ; FAST:   [[PHI:%[0-9]+]]:vcc(s1) = G_PHI [[COPY3]](s1), %bb.0, [[COPY4]](s1), %bb.1
1549  ; FAST:   [[C1:%[0-9]+]]:sgpr(s32) = G_CONSTANT i32 123
1550  ; FAST:   [[COPY5:%[0-9]+]]:vgpr(s32) = COPY [[C1]](s32)
1551  ; FAST:   [[C2:%[0-9]+]]:sgpr(s32) = G_CONSTANT i32 456
1552  ; FAST:   [[COPY6:%[0-9]+]]:vgpr(s32) = COPY [[C2]](s32)
1553  ; FAST:   [[SELECT:%[0-9]+]]:vgpr(s32) = G_SELECT [[PHI]](s1), [[COPY5]], [[COPY6]]
1554  ; FAST:   S_SETPC_B64 undef $sgpr30_sgpr31, implicit [[SELECT]](s32)
1555  ; GREEDY-LABEL: name: phi_s1_vcc_result_scc_scc_sbranch
1556  ; GREEDY: bb.0:
1557  ; GREEDY:   successors: %bb.1(0x40000000), %bb.2(0x40000000)
1558  ; GREEDY:   liveins: $sgpr0, $sgpr1, $sgpr2
1559  ; GREEDY:   [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
1560  ; GREEDY:   [[COPY1:%[0-9]+]]:sgpr(s32) = COPY $sgpr1
1561  ; GREEDY:   [[COPY2:%[0-9]+]]:sgpr(s32) = COPY $sgpr2
1562  ; GREEDY:   [[C:%[0-9]+]]:sgpr(s32) = G_CONSTANT i32 0
1563  ; GREEDY:   [[ICMP:%[0-9]+]]:sgpr(s32) = G_ICMP intpred(eq), [[COPY]](s32), [[C]]
1564  ; GREEDY:   [[TRUNC:%[0-9]+]]:sgpr(s1) = G_TRUNC [[ICMP]](s32)
1565  ; GREEDY:   [[ICMP1:%[0-9]+]]:sgpr(s32) = G_ICMP intpred(eq), [[COPY2]](s32), [[C]]
1566  ; GREEDY:   [[TRUNC1:%[0-9]+]]:sgpr(s1) = G_TRUNC [[ICMP1]](s32)
1567  ; GREEDY:   [[ZEXT:%[0-9]+]]:sgpr(s32) = G_ZEXT [[TRUNC1]](s1)
1568  ; GREEDY:   [[COPY3:%[0-9]+]]:vcc(s1) = COPY [[TRUNC]](s1)
1569  ; GREEDY:   G_BRCOND [[ZEXT]](s32), %bb.1
1570  ; GREEDY:   G_BR %bb.2
1571  ; GREEDY: bb.1:
1572  ; GREEDY:   successors: %bb.2(0x80000000)
1573  ; GREEDY:   [[ICMP2:%[0-9]+]]:sgpr(s32) = G_ICMP intpred(eq), [[COPY1]](s32), [[C]]
1574  ; GREEDY:   [[TRUNC2:%[0-9]+]]:sgpr(s1) = G_TRUNC [[ICMP2]](s32)
1575  ; GREEDY:   [[COPY4:%[0-9]+]]:vcc(s1) = COPY [[TRUNC2]](s1)
1576  ; GREEDY:   G_BR %bb.2
1577  ; GREEDY: bb.2:
1578  ; GREEDY:   [[PHI:%[0-9]+]]:vcc(s1) = G_PHI [[COPY3]](s1), %bb.0, [[COPY4]](s1), %bb.1
1579  ; GREEDY:   [[C1:%[0-9]+]]:vgpr(s32) = G_CONSTANT i32 123
1580  ; GREEDY:   [[C2:%[0-9]+]]:vgpr(s32) = G_CONSTANT i32 456
1581  ; GREEDY:   [[SELECT:%[0-9]+]]:vgpr(s32) = G_SELECT [[PHI]](s1), [[C1]], [[C2]]
1582  ; GREEDY:   S_SETPC_B64 undef $sgpr30_sgpr31, implicit [[SELECT]](s32)
1583  bb.0:
1584    successors: %bb.1, %bb.2
1585    liveins: $sgpr0, $sgpr1, $sgpr2
1586
1587    %0:_(s32) = COPY $sgpr0
1588    %1:_(s32) = COPY $sgpr1
1589    %2:_(s32) = COPY $sgpr2
1590    %3:_(s32) = G_CONSTANT i32 0
1591    %4:_(s1) = G_ICMP intpred(eq), %0, %3
1592    %5:_(s1) = G_ICMP intpred(eq), %2, %3
1593    G_BRCOND %5, %bb.1
1594    G_BR %bb.2
1595
1596  bb.1:
1597    successors: %bb.2
1598
1599    %6:_(s1) = G_ICMP intpred(eq), %1, %3
1600    G_BR %bb.2
1601
1602  bb.2:
1603    %7:vcc(s1) = G_PHI %4, %bb.0, %6, %bb.1
1604    %8:vgpr(s32) = G_CONSTANT i32 123
1605    %9:vgpr(s32) = G_CONSTANT i32 456
1606    %10:vgpr(s32) = G_SELECT %7, %8, %9
1607    S_SETPC_B64 undef $sgpr30_sgpr31, implicit %10
1608
1609...
1610