xref: /llvm-project/llvm/test/Analysis/UniformityAnalysis/AMDGPU/trivial-join-at-loop-exit.ll (revision ae77aceba5ad6ee575d3d79eb0259624322b19f4)
1; RUN: opt -mtriple amdgcn-unknown-amdhsa -passes='print<uniformity>' -disable-output %s 2>&1 | FileCheck %s
2
3; CHECK-NOT: DIVERGENT:       %Guard.bb2 = phi i1 [ true, %bb1 ], [ false, %bb0 ]
4
5; Function Attrs: nounwind readnone speculatable
6declare i32 @llvm.amdgcn.workitem.id.x() #0
7
8define protected amdgpu_kernel void @test2(i1 %uni) {
9bb0:
10  %tid.x = call i32 @llvm.amdgcn.workitem.id.x()
11  %i5 = icmp eq i32 %tid.x, -1
12  br i1 %uni, label %bb1, label %bb2
13
14bb1:                                              ; preds = %bb2, %bb0
15  %lsr.iv = phi i32 [ 7, %bb0 ], [ %lsr.iv.next, %bb1 ]
16  %lsr.iv.next = add nsw i32 %lsr.iv, -1
17  br i1 %i5, label %bb2, label %bb1
18
19bb2:                                              ; preds = %bb2, %bb1
20  %Guard.bb2 = phi i1 [ true, %bb1 ], [ false, %bb0 ]
21  ret void
22}
23
24attributes #0 = { nounwind readnone speculatable }
25