xref: /llvm-project/llvm/test/MachineVerifier/convergencectrl/AMDGPU/cycles.mir (revision 66bd3cd75b32ccfa8d228c200cf4fbf72d49fd1f)
1# RUN: not --crash llc -mtriple=amdgcn -run-pass=none -verify-machineinstrs -o /dev/null %s 2>&1 | FileCheck %s
2---
3name:            cycles
4body:             |
5  bb.0:
6    %0:sgpr_64 = CONVERGENCECTRL_ANCHOR
7    %1:sgpr_64 = IMPLICIT_DEF
8    S_CBRANCH_EXECZ %bb.9, implicit $exec
9    S_BRANCH %bb.1
10
11  bb.1:
12    S_CBRANCH_EXECZ %bb.8, implicit $exec
13    S_BRANCH %bb.5
14
15  bb.2:
16    S_CBRANCH_EXECZ %bb.3, implicit $exec
17    S_BRANCH %bb.4
18
19  bb.3:
20    ; CHECK: Cycle heart must dominate all blocks in the cycle.
21    ; Irreducible cycle: entries(bb.4 bb.3)
22    %3:sgpr_64 = CONVERGENCECTRL_LOOP %0:sgpr_64
23    S_BRANCH %bb.4
24
25  bb.4:
26    S_BRANCH %bb.3
27
28  bb.5:
29    S_CBRANCH_EXECZ %bb.6, implicit $exec
30    S_BRANCH %bb.2
31
32  bb.6:
33    S_BRANCH %bb.7
34
35  bb.7:
36    ; CHECK: Cycle heart must dominate all blocks in the cycle.
37    ; Reducible cycle: entries(bb.6) bb.7
38    %4:sgpr_64 = CONVERGENCECTRL_LOOP %0:sgpr_64
39    S_BRANCH %bb.6
40
41  bb.8:
42    ; CHECK: Two static convergence token uses in a cycle that does not contain either token's definition.
43    %5:sgpr_64 = CONVERGENCECTRL_LOOP %0:sgpr_64
44    %6:sgpr_64 = CONVERGENCECTRL_LOOP %0:sgpr_64
45    S_BRANCH %bb.8
46
47  bb.9:
48    ; CHECK: Convergence token used by an instruction other than llvm.experimental.convergence.loop in a cycle that does not contain the token's definition.
49    %7:sgpr_64 = G_SI_CALL %1:sgpr_64, 3, implicit %0:sgpr_64
50    S_BRANCH %bb.9
51
52...
53