1 # RUN: llc -mtriple=amdgcn-- -run-pass=print-machine-uniformity -o - %s 2>&1 | FileCheck %s
2 # CHECK-LABEL: MachineUniformityInfo for function: hidden_loop_diverge
4 # CHECK-LABEL: BLOCK bb.0
5 # CHECK-NOT: DIVERGENT: %{{[0-9]*}}: %{{[0-9]*}}:_(s1) = G_ICMP intpred(slt), %{{[0-9]*}}:_(s32), %{{[0-9]*}}:_
6 # CHECK-NOT: DIVERGENT: G_BRCOND %{{[0-9]*}}:_(s1), %bb.3
7 # CHECK-NOT: DIVERGENT: G_BR %bb.1
9 # CHECK-LABEL: BLOCK bb.1
10 # CHECK: DIVERGENT: %{{[0-9]*}}: %{{[0-9]*}}:_(s1) = G_ICMP intpred(slt), %{{[0-9]*}}:_(s32), %{{[0-9]*}}:_
11 # CHECK: DIVERGENT: G_BRCOND %{{[0-9]*}}:_(s1), %bb.3
12 # CHECK: DIVERGENT: G_BR %bb.2
14 # CHECK-LABEL: BLOCK bb.2
15 # CHECK: DIVERGENT: %{{[0-9]*}}: %{{[0-9]*}}:_(s1) = G_ICMP intpred(sgt), %{{[0-9]*}}:_(s32), %{{[0-9]*}}:_
16 # CHECK: DIVERGENT: G_BRCOND %{{[0-9]*}}:_(s1), %bb.4
17 # CHECK: DIVERGENT: G_BR %bb.1
19 # CHECK-LABEL: BLOCK bb.3
20 # CHECK: DIVERGENT: %{{[0-9]*}}: %{{[0-9]*}}:_(s32) = G_PHI %{{[0-9]*}}:_(s32), %bb.0, %{{[0-9]*}}:_(s32), %bb.1
21 # CHECK-NOT: DIVERGENT: G_BRCOND %{{[0-9]*}}:_(s1), %bb.4
22 # CHECK-NOT: DIVERGENT: G_BR %bb.5
24 # CHECK-LABEL: BLOCK bb.4
25 # CHECK: DIVERGENT: %{{[0-9]*}}: %{{[0-9]*}}:_(s32) = G_PHI %{{[0-9]*}}:_(s32), %bb.3, %{{[0-9]*}}:_(s32), %bb.2
27 # CHECK-LABEL: BLOCK bb.5
28 # CHECK: DIVERGENT: %{{[0-9]*}}: %{{[0-9]*}}:_(s32) = G_PHI %{{[0-9]*}}:_(s32), %bb.3, %{{[0-9]*}}:_(s32), %bb.4
31 name: hidden_loop_diverge
32 tracksRegLiveness: true
35 successors: %bb.3, %bb.1
38 %0:_(s32) = G_IMPLICIT_DEF
39 %20:_(s32) = G_IMPLICIT_DEF
40 %21:_(s32) = G_CONSTANT i32 42
41 %22:_(s32) = G_IMPLICIT_DEF
42 %1:_(s32) = G_CONSTANT i32 0
43 %2:_(s32) = G_INTRINSIC intrinsic(@llvm.amdgcn.workitem.id.x)
44 %3:_(s1) = G_ICMP intpred(slt), %0(s32), %1
45 G_BRCOND %3(s1), %bb.3 ; Uniform branch
48 successors: %bb.3, %bb.2
50 %4:_(s32) = G_PHI %1(s32), %bb.0, %7(s32), %bb.2
51 %5:_(s1) = G_ICMP intpred(slt), %1(s32), %2(s32)
52 G_BRCOND %5(s1), %bb.3 ; Divergent exit
55 successors: %bb.4, %bb.1
57 %6:_(s32) = G_CONSTANT i32 1
58 %7:_(s32) = G_ADD %6(s32), %4(s32)
59 %8:_(s1) = G_ICMP intpred(sgt), %2(s32), %1(s32)
60 G_BRCOND %8(s1), %bb.4 ; Divergent exit
63 successors: %bb.4, %bb.5
65 %9:_(s32) = G_PHI %20(s32), %bb.0, %4(s32), %bb.1 ; Temporal divergent phi
66 G_BRCOND %3(s1), %bb.4
72 %10:_(s32) = G_PHI %21(s32), %bb.3, %22(s32), %bb.2 ; Temporal divergent phi
75 %11:_(s32) = G_PHI %20(s32), %bb.3, %22(s32), %bb.4