1 ; RUN: opt -mtriple amdgcn-unknown-amdhsa -passes='print<uniformity>' -disable-output %s 2>&1 | FileCheck %s
3 define amdgpu_kernel void @hidden_diverge(i32 %n, i32 %a, i32 %b) #0 {
4 ; CHECK-LABEL: for function 'hidden_diverge'
6 %tid = call i32 @llvm.amdgcn.workitem.id.x()
7 %cond.var = icmp slt i32 %tid, 0
8 br i1 %cond.var, label %B, label %C ; divergent
9 ; CHECK: DIVERGENT: %cond.var =
10 ; CHECK: DIVERGENT: br i1 %cond.var,
12 %cond.uni = icmp slt i32 %n, 0
13 br i1 %cond.uni, label %C, label %merge ; uniform
14 ; CHECK-NOT: DIVERGENT: br i1 %cond.uni,
16 %phi.var.hidden = phi i32 [ 1, %entry ], [ 2, %B ]
17 ; CHECK: DIVERGENT: %phi.var.hidden = phi i32
20 %phi.ipd = phi i32 [ %a, %B ], [ %b, %C ]
21 ; CHECK: DIVERGENT: %phi.ipd = phi i32
25 define amdgpu_kernel void @hidden_loop_ipd(i32 %n, i32 %a, i32 %b) #0 {
26 ; CHECK-LABEL: for function 'hidden_loop_ipd'
28 %tid = call i32 @llvm.amdgcn.workitem.id.x()
29 %cond.var = icmp slt i32 %tid, 0
30 ; CHECK: DIVERGENT: %cond.var = icmp
31 %cond.uni = icmp slt i32 %n, 0
32 ; CHECK-NOT: DIVERGENT: %cond.uni = icmp
35 br i1 %cond.var, label %A, label %B
41 br i1 %cond.uni, label %E, label %D
43 br i1 %cond.var, label %for.header, label %F
46 %e.lcssa.uni = phi i32 [ 0, %C ]
47 ; CHECK-NOT: DIVERGENT: %e.lcssa.uni = phi i32
51 %f.lcssa.uni = phi i32 [ 1, %D ]
52 ; CHECK-NOT: DIVERGENT: %f.lcssa.uni = phi i32
56 %g.join.var = phi i32 [ %e.lcssa.uni, %E ], [ %f.lcssa.uni, %F ]
57 ; CHECK: DIVERGENT: %g.join.var = phi i32
62 declare i32 @llvm.amdgcn.workitem.id.x() #0
64 attributes #0 = { nounwind readnone }