104 lines · plain
1; RUN: opt %s -mtriple amdgcn-- -passes='print<uniformity>' -disable-output 2>&1 | FileCheck %s2 3; These tests have identical control flow graphs with slight changes4; that affect cycle-info. There is a minor functional difference in5; the branch conditions; but that is not relevant to the tests.6 7;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8;;9;; The cycle has a header (T) that does not dominate the join, hence10;; the entire cycle is reported as converged.11;;12;; CHECK-LABEL: UniformityInfo for function 't_header':13;; CHECK: CYCLES ASSUMED DIVERGENT:14;; CHECK: depth=1: entries(T P) S Q R15 16define amdgpu_kernel void @t_header(i32 %a, i32 %b, i32 %c) {17entry:18 %cond.uni = icmp slt i32 %a, 019 %tid = call i32 @llvm.amdgcn.workitem.id.x()20 %cond.div = icmp slt i32 %tid, 021 %a.div = add i32 %tid, %a22 br i1 %cond.uni, label %P, label %T23 24P:25; CHECK: DIVERGENT: %pp.phi =26 %pp.phi = phi i32 [ %a, %entry], [ %b, %T ]27 %pp = add i32 %b, 128 br i1 %cond.uni, label %R, label %Q29 30Q:31 %qq = add i32 %b, 132 br i1 %cond.div, label %S, label %R33 34R:35 %rr = add i32 %b, 136 br label %S37 38S:39; CHECK: DIVERGENT: %s.phi =40; CHECK: DIVERGENT: %ss =41 %s.phi = phi i32 [ %qq, %Q ], [ %rr, %R ]42 %ss = add i32 %pp.phi, 143 br i1 %cond.uni, label %exit, label %T44 45T:46; CHECK: DIVERGENT: %tt.phi =47 %tt.phi = phi i32 [ %ss, %S ], [ %a, %entry ]48 %tt = add i32 %b, 149 br label %P50 51exit:52 %ee = add i32 %b, 153 ret void54}55 56;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;57;;58;; The cycle has a header (P) that dominates the join, hence59;; the cycle is reported as converged.60;;61;; CHECK-LABEL: UniformityInfo for function 'p_header':62;; CHECK-NOT: CYCLES ASSUMED DIVERGENT:63 64define amdgpu_kernel void @p_header(i32 %a, i32 %b, i32 %c) {65entry:66 %cond.uni = icmp slt i32 %a, 067 %tid = call i32 @llvm.amdgcn.workitem.id.x()68 %cond.div = icmp slt i32 %tid, 069 br i1 %cond.uni, label %T, label %P70 71P:72; CHECK-NOT: DIVERGENT: %pp.phi = phi i3273 %pp.phi = phi i32 [ %a, %entry], [ %b, %T ]74 %pp = add i32 %b, 175 br i1 %cond.uni, label %R, label %Q76 77Q:78 %qq = add i32 %b, 179 br i1 %cond.div, label %S, label %R80 81R:82 %rr = add i32 %b, 183 br label %S84 85S:86; CHECK: DIVERGENT: %s.phi =87; CHECK-NOT: DIVERGENT: %ss = add i3288 %s.phi = phi i32 [ %qq, %Q ], [ %rr, %R ]89 %ss = add i32 %pp.phi, 190 br i1 %cond.uni, label %exit, label %T91 92T:93; CHECK-NOT: DIVERGENT: %tt.phi = phi i3294 %tt.phi = phi i32 [ %ss, %S ], [ %a, %entry ]95 %tt = add i32 %b, 196 br label %P97 98exit:99 %ee = add i32 %b, 1100 ret void101}102 103declare i32 @llvm.amdgcn.workitem.id.x() #0104