1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -march=amdgcn -verify-machineinstrs -run-pass=si-lower-control-flow -amdgpu-remove-redundant-endcf %s -o - | FileCheck -check-prefix=GCN %s
4 # Make sure dbg_value doesn't change codeegn when collapsing end_cf
6 name: simple_nested_if_dbg_value
7 tracksRegLiveness: true
11 ; GCN-LABEL: name: simple_nested_if_dbg_value
13 ; GCN: successors: %bb.1(0x40000000), %bb.4(0x40000000)
14 ; GCN: [[COPY:%[0-9]+]]:sreg_64 = COPY $exec, implicit-def $exec
15 ; GCN: [[S_AND_B64_:%[0-9]+]]:sreg_64 = S_AND_B64 [[COPY]], undef %1:sreg_64, implicit-def dead $scc
16 ; GCN: $exec = S_MOV_B64_term killed [[S_AND_B64_]]
17 ; GCN: S_CBRANCH_EXECZ %bb.4, implicit $exec
19 ; GCN: successors: %bb.2(0x40000000), %bb.4(0x40000000)
20 ; GCN: [[COPY1:%[0-9]+]]:sreg_64 = COPY $exec, implicit-def $exec
21 ; GCN: [[S_AND_B64_1:%[0-9]+]]:sreg_64 = S_AND_B64 [[COPY1]], undef %3:sreg_64, implicit-def dead $scc
22 ; GCN: $exec = S_MOV_B64_term killed [[S_AND_B64_1]]
23 ; GCN: S_CBRANCH_EXECZ %bb.4, implicit $exec
25 ; GCN: successors: %bb.4(0x80000000)
27 ; GCN: $exec = S_OR_B64 $exec, [[COPY]], implicit-def $scc
31 successors: %bb.1, %bb.4
33 %0:sreg_64 = SI_IF undef %1:sreg_64, %bb.4, implicit-def dead $exec, implicit-def dead $scc, implicit $exec
36 successors: %bb.2, %bb.3
38 %2:sreg_64 = SI_IF undef %3:sreg_64, %bb.3, implicit-def dead $exec, implicit-def dead $scc, implicit $exec
43 SI_END_CF %2:sreg_64, implicit-def dead $exec, implicit-def dead $scc, implicit $exec
48 SI_END_CF %0:sreg_64, implicit-def dead $exec, implicit-def dead $scc, implicit $exec
53 # Empty block separates the collapsable s_or_b64
55 name: simple_nested_if_empty_block_between
56 tracksRegLiveness: true
60 ; GCN-LABEL: name: simple_nested_if_empty_block_between
62 ; GCN: successors: %bb.5(0x40000000), %bb.1(0x40000000)
63 ; GCN: [[COPY:%[0-9]+]]:sreg_64 = COPY $exec, implicit-def $exec
64 ; GCN: [[S_AND_B64_:%[0-9]+]]:sreg_64 = S_AND_B64 [[COPY]], undef %1:sreg_64, implicit-def dead $scc
65 ; GCN: $exec = S_MOV_B64_term killed [[S_AND_B64_]]
66 ; GCN: S_CBRANCH_EXECZ %bb.5, implicit $exec
68 ; GCN: successors: %bb.2(0x40000000), %bb.4(0x40000000)
69 ; GCN: [[COPY1:%[0-9]+]]:sreg_64 = COPY $exec, implicit-def $exec
70 ; GCN: [[S_AND_B64_1:%[0-9]+]]:sreg_64 = S_AND_B64 [[COPY1]], undef %3:sreg_64, implicit-def dead $scc
71 ; GCN: $exec = S_MOV_B64_term killed [[S_AND_B64_1]]
72 ; GCN: S_CBRANCH_EXECZ %bb.4, implicit $exec
74 ; GCN: successors: %bb.4(0x80000000)
76 ; GCN: successors: %bb.5(0x80000000)
78 ; GCN: $exec = S_OR_B64 $exec, [[COPY]], implicit-def $scc
81 %0:sreg_64 = SI_IF undef %1:sreg_64, %bb.4, implicit-def dead $exec, implicit-def dead $scc, implicit $exec
84 successors: %bb.2, %bb.3
86 %2:sreg_64 = SI_IF undef %3:sreg_64, %bb.3, implicit-def dead $exec, implicit-def dead $scc, implicit $exec
91 SI_END_CF %2:sreg_64, implicit-def dead $exec, implicit-def dead $scc, implicit $exec
96 SI_END_CF %0:sreg_64, implicit-def dead $exec, implicit-def dead $scc, implicit $exec
101 # Effectively empty block separates the collapsable s_or_b64
103 name: simple_nested_if_empty_block_dbg_between
104 tracksRegLiveness: true
106 isEntryFunction: true
108 ; GCN-LABEL: name: simple_nested_if_empty_block_dbg_between
110 ; GCN: successors: %bb.1(0x40000000), %bb.5(0x40000000)
111 ; GCN: [[COPY:%[0-9]+]]:sreg_64 = COPY $exec, implicit-def $exec
112 ; GCN: [[S_AND_B64_:%[0-9]+]]:sreg_64 = S_AND_B64 [[COPY]], undef %1:sreg_64, implicit-def dead $scc
113 ; GCN: $exec = S_MOV_B64_term killed [[S_AND_B64_]]
114 ; GCN: S_CBRANCH_EXECZ %bb.5, implicit $exec
116 ; GCN: successors: %bb.2(0x40000000), %bb.4(0x40000000)
117 ; GCN: [[COPY1:%[0-9]+]]:sreg_64 = COPY $exec, implicit-def $exec
118 ; GCN: [[S_AND_B64_1:%[0-9]+]]:sreg_64 = S_AND_B64 [[COPY1]], undef %3:sreg_64, implicit-def dead $scc
119 ; GCN: $exec = S_MOV_B64_term killed [[S_AND_B64_1]]
120 ; GCN: S_CBRANCH_EXECZ %bb.4, implicit $exec
122 ; GCN: successors: %bb.4(0x80000000)
124 ; GCN: successors: %bb.5(0x80000000)
127 ; GCN: $exec = S_OR_B64 $exec, [[COPY]], implicit-def $scc
130 successors: %bb.1, %bb.4
132 %0:sreg_64 = SI_IF undef %1:sreg_64, %bb.4, implicit-def dead $exec, implicit-def dead $scc, implicit $exec
135 successors: %bb.2, %bb.3
137 %2:sreg_64 = SI_IF undef %3:sreg_64, %bb.3, implicit-def dead $exec, implicit-def dead $scc, implicit $exec
142 SI_END_CF %2:sreg_64, implicit-def dead $exec, implicit-def dead $scc, implicit $exec
148 SI_END_CF %0:sreg_64, implicit-def dead $exec, implicit-def dead $scc, implicit $exec
154 name: skip_salu_and_meta_insts_find_first
155 tracksRegLiveness: true
157 isEntryFunction: true
159 ; GCN-LABEL: name: skip_salu_and_meta_insts_find_first
161 ; GCN: successors: %bb.1(0x40000000), %bb.4(0x40000000)
162 ; GCN: liveins: $vgpr0, $sgpr0_sgpr1
163 ; GCN: [[COPY:%[0-9]+]]:sreg_64 = COPY $exec, implicit-def $exec
164 ; GCN: [[S_AND_B64_:%[0-9]+]]:sreg_64 = S_AND_B64 [[COPY]], undef %1:sreg_64, implicit-def dead $scc
165 ; GCN: $exec = S_MOV_B64_term killed [[S_AND_B64_]]
166 ; GCN: S_CBRANCH_EXECZ %bb.4, implicit $exec
168 ; GCN: successors: %bb.2(0x40000000), %bb.3(0x40000000)
169 ; GCN: [[COPY1:%[0-9]+]]:sreg_64 = COPY $exec, implicit-def $exec
170 ; GCN: [[S_AND_B64_1:%[0-9]+]]:sreg_64 = S_AND_B64 [[COPY1]], undef %3:sreg_64, implicit-def dead $scc
171 ; GCN: $exec = S_MOV_B64_term killed [[S_AND_B64_1]]
172 ; GCN: S_CBRANCH_EXECZ %bb.3, implicit $exec
174 ; GCN: successors: %bb.3(0x80000000)
176 ; GCN: successors: %bb.4(0x80000000)
177 ; GCN: [[DEF:%[0-9]+]]:sgpr_32 = IMPLICIT_DEF
178 ; GCN: [[S_BREV_B32_:%[0-9]+]]:sgpr_32 = S_BREV_B32 [[DEF]]
181 ; GCN: $exec = S_OR_B64 $exec, [[COPY]], implicit-def $scc
184 successors: %bb.1, %bb.4
185 liveins: $vgpr0, $sgpr0_sgpr1
187 %0:sreg_64 = SI_IF undef %1:sreg_64, %bb.4, implicit-def dead $exec, implicit-def dead $scc, implicit $exec
190 successors: %bb.2, %bb.3
192 %2:sreg_64 = SI_IF undef %3:sreg_64, %bb.3, implicit-def dead $exec, implicit-def dead $scc, implicit $exec
197 %4:sgpr_32 = IMPLICIT_DEF
198 %5:sgpr_32 = S_BREV_B32 %4
200 SI_END_CF %2:sreg_64, implicit-def dead $exec, implicit-def dead $scc, implicit $exec
203 SI_END_CF %0:sreg_64, implicit-def dead $exec, implicit-def dead $scc, implicit $exec
208 # Make sure SALU instructions, meta instructions, and SGPR->SGPR
209 # copies are skipped.
211 name: skip_salu_and_meta_insts_after
212 tracksRegLiveness: true
214 isEntryFunction: true
216 ; GCN-LABEL: name: skip_salu_and_meta_insts_after
218 ; GCN: successors: %bb.1(0x40000000), %bb.4(0x40000000)
219 ; GCN: [[COPY:%[0-9]+]]:sreg_64 = COPY $exec, implicit-def $exec
220 ; GCN: [[S_AND_B64_:%[0-9]+]]:sreg_64 = S_AND_B64 [[COPY]], undef %1:sreg_64, implicit-def dead $scc
221 ; GCN: $exec = S_MOV_B64_term killed [[S_AND_B64_]]
222 ; GCN: S_CBRANCH_EXECZ %bb.4, implicit $exec
224 ; GCN: successors: %bb.2(0x40000000), %bb.3(0x40000000)
225 ; GCN: [[COPY1:%[0-9]+]]:sreg_64 = COPY $exec, implicit-def $exec
226 ; GCN: [[S_AND_B64_1:%[0-9]+]]:sreg_64 = S_AND_B64 [[COPY1]], undef %3:sreg_64, implicit-def dead $scc
227 ; GCN: $exec = S_MOV_B64_term killed [[S_AND_B64_1]]
228 ; GCN: S_CBRANCH_EXECZ %bb.3, implicit $exec
230 ; GCN: successors: %bb.3(0x80000000)
232 ; GCN: successors: %bb.4(0x80000000)
233 ; GCN: [[DEF:%[0-9]+]]:sgpr_32 = IMPLICIT_DEF
234 ; GCN: [[S_BREV_B32_:%[0-9]+]]:sgpr_32 = S_BREV_B32 [[DEF]]
236 ; GCN: [[COPY2:%[0-9]+]]:sgpr_32 = COPY [[S_BREV_B32_]]
238 ; GCN: $exec = S_OR_B64 $exec, [[COPY]], implicit-def $scc
241 successors: %bb.1, %bb.4
243 %0:sreg_64 = SI_IF undef %1:sreg_64, %bb.4, implicit-def dead $exec, implicit-def dead $scc, implicit $exec
246 successors: %bb.2, %bb.3
248 %2:sreg_64 = SI_IF undef %3:sreg_64, %bb.3, implicit-def dead $exec, implicit-def dead $scc, implicit $exec
253 SI_END_CF %2:sreg_64, implicit-def dead $exec, implicit-def dead $scc, implicit $exec
254 %4:sgpr_32 = IMPLICIT_DEF
255 %5:sgpr_32 = S_BREV_B32 %4
260 SI_END_CF %0:sreg_64, implicit-def dead $exec, implicit-def dead $scc, implicit $exec
265 # SALU instruction depends on exec through a normal operand.
267 name: salu_exec_dependency
268 tracksRegLiveness: true
270 isEntryFunction: true
272 ; GCN-LABEL: name: salu_exec_dependency
274 ; GCN: successors: %bb.1(0x40000000), %bb.4(0x40000000)
275 ; GCN: [[COPY:%[0-9]+]]:sreg_64 = COPY $exec, implicit-def $exec
276 ; GCN: [[S_AND_B64_:%[0-9]+]]:sreg_64 = S_AND_B64 [[COPY]], undef %1:sreg_64, implicit-def dead $scc
277 ; GCN: $exec = S_MOV_B64_term killed [[S_AND_B64_]]
278 ; GCN: S_CBRANCH_EXECZ %bb.4, implicit $exec
280 ; GCN: successors: %bb.2(0x40000000), %bb.3(0x40000000)
281 ; GCN: [[COPY1:%[0-9]+]]:sreg_64 = COPY $exec, implicit-def $exec
282 ; GCN: [[S_AND_B64_1:%[0-9]+]]:sreg_64 = S_AND_B64 [[COPY1]], undef %3:sreg_64, implicit-def dead $scc
283 ; GCN: $exec = S_MOV_B64_term killed [[S_AND_B64_1]]
284 ; GCN: S_CBRANCH_EXECZ %bb.3, implicit $exec
286 ; GCN: successors: %bb.3(0x80000000)
288 ; GCN: successors: %bb.4(0x80000000)
289 ; GCN: $exec = S_OR_B64 $exec, [[COPY1]], implicit-def $scc
290 ; GCN: [[S_BREV_B64_:%[0-9]+]]:sreg_64 = S_BREV_B64 $exec
292 ; GCN: $exec = S_OR_B64 $exec, [[COPY]], implicit-def $scc
295 successors: %bb.1, %bb.4
297 %0:sreg_64 = SI_IF undef %1:sreg_64, %bb.4, implicit-def dead $exec, implicit-def dead $scc, implicit $exec
300 successors: %bb.2, %bb.3
302 %2:sreg_64 = SI_IF undef %3:sreg_64, %bb.3, implicit-def dead $exec, implicit-def dead $scc, implicit $exec
307 SI_END_CF %2:sreg_64, implicit-def dead $exec, implicit-def dead $scc, implicit $exec
308 %4:sreg_64 = S_BREV_B64 $exec
311 SI_END_CF %0:sreg_64, implicit-def dead $exec, implicit-def dead $scc, implicit $exec
316 # Copy to / from VGPR should be assumed to read exec
318 name: copy_no_explicit_exec_dependency
319 tracksRegLiveness: true
321 isEntryFunction: true
323 ; GCN-LABEL: name: copy_no_explicit_exec_dependency
325 ; GCN: successors: %bb.1(0x40000000), %bb.4(0x40000000)
326 ; GCN: [[COPY:%[0-9]+]]:sreg_64 = COPY $exec, implicit-def $exec
327 ; GCN: [[S_AND_B64_:%[0-9]+]]:sreg_64 = S_AND_B64 [[COPY]], undef %1:sreg_64, implicit-def dead $scc
328 ; GCN: $exec = S_MOV_B64_term killed [[S_AND_B64_]]
329 ; GCN: S_CBRANCH_EXECZ %bb.4, implicit $exec
331 ; GCN: successors: %bb.2(0x40000000), %bb.3(0x40000000)
332 ; GCN: [[DEF:%[0-9]+]]:vreg_128 = IMPLICIT_DEF
333 ; GCN: [[COPY1:%[0-9]+]]:sreg_64 = COPY $exec, implicit-def $exec
334 ; GCN: [[S_AND_B64_1:%[0-9]+]]:sreg_64 = S_AND_B64 [[COPY1]], undef %4:sreg_64, implicit-def dead $scc
335 ; GCN: $exec = S_MOV_B64_term killed [[S_AND_B64_1]]
336 ; GCN: S_CBRANCH_EXECZ %bb.3, implicit $exec
338 ; GCN: successors: %bb.3(0x80000000)
340 ; GCN: successors: %bb.4(0x80000000)
341 ; GCN: $exec = S_OR_B64 $exec, [[COPY1]], implicit-def $scc
342 ; GCN: [[COPY2:%[0-9]+]]:vgpr_32 = COPY [[DEF]].sub2
344 ; GCN: $exec = S_OR_B64 $exec, [[COPY]], implicit-def $scc
347 successors: %bb.1, %bb.4
349 %0:sreg_64 = SI_IF undef %1:sreg_64, %bb.4, implicit-def dead $exec, implicit-def dead $scc, implicit $exec
352 successors: %bb.2, %bb.3
354 %2:vreg_128 = IMPLICIT_DEF
355 %3:sreg_64 = SI_IF undef %4:sreg_64, %bb.3, implicit-def dead $exec, implicit-def dead $scc, implicit $exec
360 SI_END_CF %3:sreg_64, implicit-def dead $exec, implicit-def dead $scc, implicit $exec
361 %5:vgpr_32 = COPY %2.sub2
364 SI_END_CF %0:sreg_64, implicit-def dead $exec, implicit-def dead $scc, implicit $exec
370 name: simple_nested_if_not_layout_successor
371 tracksRegLiveness: true
373 isEntryFunction: true
375 ; GCN-LABEL: name: simple_nested_if_not_layout_successor
377 ; GCN: successors: %bb.1(0x40000000), %bb.4(0x40000000)
378 ; GCN: [[COPY:%[0-9]+]]:sreg_64 = COPY $exec, implicit-def $exec
379 ; GCN: [[S_AND_B64_:%[0-9]+]]:sreg_64 = S_AND_B64 [[COPY]], undef %1:sreg_64, implicit-def dead $scc
380 ; GCN: $exec = S_MOV_B64_term killed [[S_AND_B64_]]
381 ; GCN: S_CBRANCH_EXECZ %bb.4, implicit $exec
383 ; GCN: successors: %bb.2(0x40000000), %bb.5(0x40000000)
384 ; GCN: [[COPY1:%[0-9]+]]:sreg_64 = COPY $exec, implicit-def $exec
385 ; GCN: [[S_AND_B64_1:%[0-9]+]]:sreg_64 = S_AND_B64 [[COPY1]], undef %3:sreg_64, implicit-def dead $scc
386 ; GCN: $exec = S_MOV_B64_term killed [[S_AND_B64_1]]
387 ; GCN: S_CBRANCH_EXECZ %bb.5, implicit $exec
389 ; GCN: successors: %bb.5(0x80000000)
391 ; GCN: successors: %bb.4(0x80000000)
392 ; GCN: S_BRANCH %bb.4
394 ; GCN: $exec = S_OR_B64 $exec, [[COPY]], implicit-def $scc
397 successors: %bb.1, %bb.4
399 %0:sreg_64 = SI_IF undef %1:sreg_64, %bb.4, implicit-def dead $exec, implicit-def dead $scc, implicit $exec
402 successors: %bb.2, %bb.3
404 %2:sreg_64 = SI_IF undef %3:sreg_64, %bb.3, implicit-def dead $exec, implicit-def dead $scc, implicit $exec
409 SI_END_CF %2:sreg_64, implicit-def dead $exec, implicit-def dead $scc, implicit $exec
413 SI_END_CF %0:sreg_64, implicit-def dead $exec, implicit-def dead $scc, implicit $exec
421 # This should never happen, but check that we do not hang anyway
424 name: resursive_endcf
425 tracksRegLiveness: true
427 - { reg: '$vgpr0', virtual-reg: '%0' }
429 isEntryFunction: true
431 ; GCN-LABEL: name: resursive_endcf
433 ; GCN: successors: %bb.1(0x80000000)
434 ; GCN: liveins: $vgpr0
435 ; GCN: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
436 ; GCN: [[V_CMP_LT_U32_e64_:%[0-9]+]]:sreg_64 = V_CMP_LT_U32_e64 1, [[COPY]], implicit $exec
438 ; GCN: successors: %bb.1(0x80000000)
439 ; GCN: $exec = S_OR_B64 $exec, [[V_CMP_LT_U32_e64_]], implicit-def $scc
440 ; GCN: S_BRANCH %bb.1
445 %0:vgpr_32 = COPY $vgpr0
446 %2:sreg_64 = V_CMP_LT_U32_e64 1, %0, implicit $exec
451 SI_END_CF %2:sreg_64, implicit-def dead $exec, implicit-def dead $scc, implicit $exec
456 # Both s_or_b64 shall be preserved since the outer SI_END_CF belongs to SI_ELSE.
459 name: simple_outer_if_else
460 tracksRegLiveness: true
462 isEntryFunction: true
464 ; GCN-LABEL: name: simple_outer_if_else
466 ; GCN: successors: %bb.1(0x40000000), %bb.2(0x40000000)
467 ; GCN: [[COPY:%[0-9]+]]:sreg_64 = COPY $exec, implicit-def $exec
468 ; GCN: [[S_AND_B64_:%[0-9]+]]:sreg_64 = S_AND_B64 [[COPY]], undef %1:sreg_64, implicit-def dead $scc
469 ; GCN: [[S_XOR_B64_:%[0-9]+]]:sreg_64 = S_XOR_B64 [[S_AND_B64_]], [[COPY]], implicit-def dead $scc
470 ; GCN: $exec = S_MOV_B64_term killed [[S_AND_B64_]]
471 ; GCN: S_CBRANCH_EXECZ %bb.2, implicit $exec
473 ; GCN: successors: %bb.2(0x80000000)
474 ; GCN: S_BRANCH %bb.2
476 ; GCN: successors: %bb.3(0x40000000), %bb.6(0x40000000)
477 ; GCN: [[S_OR_SAVEEXEC_B64_:%[0-9]+]]:sreg_64 = S_OR_SAVEEXEC_B64 [[S_XOR_B64_]], implicit-def $exec, implicit-def $scc, implicit $exec
478 ; GCN: [[S_AND_B64_1:%[0-9]+]]:sreg_64 = S_AND_B64 $exec, [[S_OR_SAVEEXEC_B64_]], implicit-def $scc
479 ; GCN: $exec = S_XOR_B64_term $exec, [[S_AND_B64_1]], implicit-def $scc
480 ; GCN: S_CBRANCH_EXECZ %bb.6, implicit $exec
482 ; GCN: successors: %bb.3(0x40000000), %bb.4(0x40000000)
483 ; GCN: [[COPY1:%[0-9]+]]:sreg_64 = COPY $exec, implicit-def $exec
484 ; GCN: [[S_AND_B64_2:%[0-9]+]]:sreg_64 = S_AND_B64 [[COPY1]], undef %4:sreg_64, implicit-def dead $scc
485 ; GCN: $exec = S_MOV_B64_term killed [[S_AND_B64_2]]
486 ; GCN: S_CBRANCH_EXECZ %bb.3, implicit $exec
488 ; GCN: successors: %bb.5(0x80000000)
490 ; GCN: successors: %bb.6(0x80000000)
491 ; GCN: $exec = S_OR_B64 $exec, [[COPY1]], implicit-def $scc
493 ; GCN: $exec = S_OR_B64 $exec, [[S_AND_B64_1]], implicit-def $scc
496 successors: %bb.1, %bb.2
498 %0:sreg_64 = SI_IF undef %1:sreg_64, %bb.2, implicit-def dead $exec, implicit-def dead $scc, implicit $exec
505 successors: %bb.3, %bb.6
506 %2:sreg_64 = SI_ELSE %0:sreg_64, %bb.6, implicit-def dead $exec, implicit-def dead $scc, implicit $exec
509 successors: %bb.3, %bb.4
511 %3:sreg_64 = SI_IF undef %4:sreg_64, %bb.3, implicit-def dead $exec, implicit-def dead $scc, implicit $exec
519 SI_END_CF %3:sreg_64, implicit-def dead $exec, implicit-def dead $scc, implicit $exec
522 SI_END_CF %2:sreg_64, implicit-def dead $exec, implicit-def dead $scc, implicit $exec
529 tracksRegLiveness: true
531 isEntryFunction: true
533 ; GCN-LABEL: name: if_inside_loop
535 ; GCN: successors: %bb.6(0x80000000)
536 ; GCN: S_BRANCH %bb.6
538 ; GCN: successors: %bb.3(0x40000000), %bb.2(0x40000000)
539 ; GCN: [[COPY:%[0-9]+]]:sreg_64 = COPY $exec, implicit-def $exec
540 ; GCN: [[S_AND_B64_:%[0-9]+]]:sreg_64 = S_AND_B64 [[COPY]], undef %1:sreg_64, implicit-def dead $scc
541 ; GCN: $exec = S_MOV_B64_term killed [[S_AND_B64_]]
542 ; GCN: S_CBRANCH_EXECZ %bb.3, implicit $exec
544 ; GCN: successors: %bb.6(0x80000000)
545 ; GCN: S_BRANCH %bb.6
547 ; GCN: successors: %bb.4(0x80000000)
548 ; GCN: $exec = S_OR_B64 $exec, [[COPY]], implicit-def $scc
550 ; GCN: successors: %bb.5(0x80000000)
551 ; GCN: $exec = S_OR_B64 $exec, %2, implicit-def $scc
553 ; GCN: successors: %bb.6(0x80000000)
555 ; GCN: successors: %bb.4(0x40000000), %bb.0(0x40000000)
556 ; GCN: [[COPY1:%[0-9]+]]:sreg_64 = COPY $exec, implicit-def $exec
557 ; GCN: [[S_AND_B64_1:%[0-9]+]]:sreg_64 = S_AND_B64 [[COPY1]], undef %3:sreg_64, implicit-def dead $scc
558 ; GCN: [[S_XOR_B64_:%[0-9]+]]:sreg_64 = S_XOR_B64 [[S_AND_B64_1]], [[COPY1]], implicit-def dead $scc
559 ; GCN: $exec = S_MOV_B64_term killed [[S_AND_B64_1]]
560 ; GCN: S_CBRANCH_EXECZ %bb.4, implicit $exec
561 ; GCN: S_BRANCH %bb.0
567 %0:sreg_64 = SI_IF undef %1:sreg_64, %bb.3, implicit-def dead $exec, implicit-def dead $scc, implicit $exec
573 SI_END_CF %0:sreg_64, implicit-def dead $exec, implicit-def dead $scc, implicit $exec
576 SI_END_CF %2:sreg_64, implicit-def dead $exec, implicit-def dead $scc, implicit $exec
581 %2:sreg_64 = SI_IF undef %3:sreg_64, %bb.4, implicit-def dead $exec, implicit-def dead $scc, implicit $exec
588 # redundant MBB removal correctness test:
589 # we can keep bb.2 fallthrough to the new succ because after bb.3 gets removed
590 # new succ (bb.4) becomes bb.2's layout successor
591 name: removed_succ_fallthrough_but_layout_successor
592 tracksRegLiveness: true
594 isEntryFunction: true
596 ; GCN-LABEL: name: removed_succ_fallthrough_but_layout_successor
598 ; GCN: successors: %bb.1(0x40000000), %bb.4(0x40000000)
599 ; GCN: [[COPY:%[0-9]+]]:sreg_64 = COPY $exec, implicit-def $exec
600 ; GCN: [[S_AND_B64_:%[0-9]+]]:sreg_64 = S_AND_B64 [[COPY]], undef %1:sreg_64, implicit-def dead $scc
601 ; GCN: $exec = S_MOV_B64_term killed [[S_AND_B64_]]
602 ; GCN: S_CBRANCH_EXECZ %bb.4, implicit $exec
604 ; GCN: successors: %bb.2(0x40000000), %bb.4(0x40000000)
605 ; GCN: [[COPY1:%[0-9]+]]:sreg_64 = COPY $exec, implicit-def $exec
606 ; GCN: [[S_AND_B64_1:%[0-9]+]]:sreg_64 = S_AND_B64 [[COPY1]], undef %3:sreg_64, implicit-def dead $scc
607 ; GCN: $exec = S_MOV_B64_term killed [[S_AND_B64_1]]
608 ; GCN: S_CBRANCH_EXECZ %bb.4, implicit $exec
610 ; GCN: successors: %bb.4(0x80000000)
612 ; GCN: successors: %bb.5(0x80000000)
613 ; GCN: $exec = S_OR_B64 $exec, [[COPY]], implicit-def $scc
617 successors: %bb.1, %bb.4
619 %0:sreg_64 = SI_IF undef %1:sreg_64, %bb.4, implicit-def dead $exec, implicit-def dead $scc, implicit $exec
622 successors: %bb.2, %bb.3
624 %2:sreg_64 = SI_IF undef %3:sreg_64, %bb.3, implicit-def dead $exec, implicit-def dead $scc, implicit $exec
629 SI_END_CF %2:sreg_64, implicit-def dead $exec, implicit-def dead $scc, implicit $exec
633 SI_END_CF %0:sreg_64, implicit-def dead $exec, implicit-def dead $scc, implicit $exec
641 # redundant MBB removal correctness test:
642 # If one of the remdundant block preds has a fallthrough path, but the only redundant block succ is not
643 # going to be a layout successor to that pred after redundant block removal, we should not rearrange
644 # blocks to keep pred's fallthrough path, if the succ has fallthrough path to one of it's succ too.
646 name: deleted_succ_fallthrough_not_layout_successor
647 tracksRegLiveness: true
649 isEntryFunction: true
651 ; GCN-LABEL: name: deleted_succ_fallthrough_not_layout_successor
653 ; GCN: successors: %bb.1(0x40000000), %bb.4(0x40000000)
654 ; GCN: [[COPY:%[0-9]+]]:sreg_64 = COPY $exec, implicit-def $exec
655 ; GCN: [[S_AND_B64_:%[0-9]+]]:sreg_64 = S_AND_B64 [[COPY]], undef %1:sreg_64, implicit-def dead $scc
656 ; GCN: $exec = S_MOV_B64_term killed [[S_AND_B64_]]
657 ; GCN: S_CBRANCH_EXECZ %bb.4, implicit $exec
659 ; GCN: successors: %bb.2(0x40000000), %bb.5(0x40000000)
660 ; GCN: [[COPY1:%[0-9]+]]:sreg_64 = COPY $exec, implicit-def $exec
661 ; GCN: [[S_AND_B64_1:%[0-9]+]]:sreg_64 = S_AND_B64 [[COPY1]], undef %3:sreg_64, implicit-def dead $scc
662 ; GCN: $exec = S_MOV_B64_term killed [[S_AND_B64_1]]
663 ; GCN: S_CBRANCH_EXECZ %bb.5, implicit $exec
665 ; GCN: successors: %bb.5(0x80000000)
666 ; GCN: S_BRANCH %bb.5
670 ; GCN: successors: %bb.6(0x80000000)
671 ; GCN: $exec = S_OR_B64 $exec, [[COPY]], implicit-def $scc
673 ; GCN: successors: %bb.4(0x80000000)
674 ; GCN: S_BRANCH %bb.4
676 successors: %bb.1, %bb.4
678 %0:sreg_64 = SI_IF undef %1:sreg_64, %bb.4, implicit-def dead $exec, implicit-def dead $scc, implicit $exec
681 successors: %bb.2, %bb.3
683 %2:sreg_64 = SI_IF undef %3:sreg_64, %bb.3, implicit-def dead $exec, implicit-def dead $scc, implicit $exec
688 SI_END_CF %2:sreg_64, implicit-def dead $exec, implicit-def dead $scc, implicit $exec
696 SI_END_CF %0:sreg_64, implicit-def dead $exec, implicit-def dead $scc, implicit $exec