• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt -mtriple amdgcn-unknown-amdhsa -analyze -divergence -use-gpu-divergence-analysis %s | FileCheck %s
2
3; CHECK: bb3:
4; CHECK: DIVERGENT:       %Guard.bb4 = phi i1 [ true, %bb1 ], [ false, %bb2 ]
5; CHECK: DIVERGENT:       br i1 %Guard.bb4, label %bb4, label %bb5
6
7; Function Attrs: nounwind readnone speculatable
8declare i32 @llvm.amdgcn.workitem.id.x() #0
9
10define protected amdgpu_kernel void @test() {
11bb0:
12  %tid.x = call i32 @llvm.amdgcn.workitem.id.x()
13  %i5 = icmp eq i32 %tid.x, -1
14  br label %bb1
15
16bb1:                                              ; preds = %bb2, %bb0
17  %lsr.iv = phi i32 [ 7, %bb0 ], [ %lsr.iv.next, %bb2 ]
18  br i1 %i5, label %bb2, label %bb3
19
20bb2:                                              ; preds = %bb1
21  %lsr.iv.next = add nsw i32 %lsr.iv, -1
22  %i14 = icmp eq i32 %lsr.iv.next, 0
23  br i1 %i14, label %bb3, label %bb1
24
25bb3:                                              ; preds = %bb2, %bb1
26  %Guard.bb4 = phi i1 [ true, %bb1 ], [ false, %bb2 ]
27  br i1 %Guard.bb4, label %bb4, label %bb5
28
29bb4:                                              ; preds = %bb3
30  br label %bb5
31
32bb5:                                              ; preds = %bb3, %bb4
33  ret void
34}
35
36attributes #0 = { nounwind readnone speculatable }
37