1 # RUN: llc -mtriple=amdgcn-- -run-pass=print-machine-uniformity -o - %s 2>&1 | FileCheck %s
2 # CHECK-LABEL: MachineUniformityInfo for function: divergent_cycle_1
3 # CHECK-NEXT: CYCLES ASSSUMED DIVERGENT:
4 # CHECK-NEXT: depth=1: entries(bb.3 bb.1) bb.4 bb.2
5 # CHECK-NEXT: CYCLES WITH DIVERGENT EXIT:
6 # CHECK-NEXT: depth=2: entries(bb.4 bb.1) bb.2
7 # CHECK-NEXT: depth=1: entries(bb.3 bb.1) bb.4 bb.2
12 name: divergent_cycle_1
13 tracksRegLiveness: true
16 successors: %bb.1, %bb.3
17 %0:_(s32) = G_CONSTANT i32 0
18 %1:_(s32) = G_CONSTANT i32 1
20 %2:_(s32) = G_IMPLICIT_DEF
21 %3:_(s32) = G_IMPLICIT_DEF
23 %4:_(s32) = G_INTRINSIC intrinsic(@llvm.amdgcn.workitem.id.x)
24 %6:_(s1) = G_ICMP intpred(slt), %2(s32), %0(s32) ;uniform condition
25 %7:_(s1) = G_ICMP intpred(eq), %4(s32), %0 ;divergent condition
26 G_BRCOND %6(s1), %bb.1
32 ; CHECK: DIVERGENT: %{{[0-9]*}}: %{{[0-9]*}}:_(s32) = G_PHI %{{[0-9]*}}:_(s32), %bb.0, %{{[0-9]*}}:_(s32), %bb.4
33 %8:_(s32) = G_PHI %2(s32), %bb.0, %3(s32), %bb.4
34 %9:_(s32) = G_ADD %3(s32), %1(s32)
38 successors: %bb.3, %bb.4
40 %13:_(s32) = G_ADD %3(s32), %1(s32)
41 G_BRCOND %7(s1), %bb.4
47 %14:_(s32) = G_ADD %3(s32), %1(s32)
50 successors: %bb.5, %bb.1
52 ; CHECK: DIVERGENT: %{{[0-9]*}}: %{{[0-9]*}}:_(s32) = G_PHI %{{[0-9]*}}:_(s32), %bb.2, %{{[0-9]*}}:_(s32), %bb.3
53 %15:_(s32) = G_PHI %13(s32), %bb.2, %14(s32), %bb.3
54 %16:_(s32) = G_ADD %3(s32), %1(s32)
55 G_BRCOND %6(s1), %bb.5
59 %17:_(s32) = G_ADD %3(s32), %1(s32)
63 # CHECK-LABEL: MachineUniformityInfo for function: uniform_cycle_1
66 tracksRegLiveness: true
69 successors: %bb.1, %bb.5
70 %0:_(s32) = G_CONSTANT i32 0
71 %1:_(s32) = G_CONSTANT i32 1
73 %2:_(s32) = G_IMPLICIT_DEF
74 %3:_(s32) = G_IMPLICIT_DEF
76 %4:_(s32) = G_INTRINSIC intrinsic(@llvm.amdgcn.workitem.id.x)
77 %6:_(s1) = G_ICMP intpred(slt), %2(s32), %0(s32) ;uniform condition
78 %7:_(s1) = G_ICMP intpred(eq), %4(s32), %0 ;divergent condition
79 G_BRCOND %6(s1), %bb.1
85 ; CHECK-NOT: DIVERGENT: %{{[0-9]*}}: %{{[0-9]*}}:_(s32) = G_PHI %{{[0-9]*}}:_(s32), %bb.0, %{{[0-9]*}}:_(s32), %bb.4
86 %8:_(s32) = G_PHI %2(s32), %bb.0, %3(s32), %bb.5
87 %9:_(s32) = G_ADD %3(s32), %1(s32)
91 successors: %bb.3, %bb.4
93 %13:_(s32) = G_ADD %3(s32), %1(s32)
94 G_BRCOND %7(s1), %bb.4
100 %14:_(s32) = G_ADD %3(s32), %1(s32)
103 successors: %bb.6, %bb.5
105 ; CHECK: DIVERGENT: %{{[0-9]*}}: %{{[0-9]*}}:_(s32) = G_PHI %{{[0-9]*}}:_(s32), %bb.2, %{{[0-9]*}}:_(s32), %bb.3
106 %15:_(s32) = G_PHI %13(s32), %bb.2, %14(s32), %bb.3
107 %16:_(s32) = G_ADD %3(s32), %1(s32)
108 G_BRCOND %6(s1), %bb.6
113 %18:_(s32) = G_ADD %3(s32), %1(s32)
116 %17:_(s32) = G_ADD %3(s32), %1(s32)