1; RUN: opt -mtriple=amdgcn-- -amdgpu-use-legacy-divergence-analysis -analyze -divergence %s | FileCheck %s
2
3; CHECK-LABEL: 'test1':
4; CHECK-NEXT: DIVERGENT: i32 %bound
5; CHECK: {{^  *}}%counter =
6; CHECK-NEXT: DIVERGENT: %break = icmp sge i32 %counter, %bound
7; CHECK-NEXT: DIVERGENT: br i1 %break, label %footer, label %body
8; CHECK: {{^  *}}%counter.next =
9; CHECK: {{^  *}}%counter.footer =
10; CHECK: DIVERGENT: br i1 %break, label %end, label %header
11; Note: %counter is not divergent!
12define amdgpu_ps void @test1(i32 %bound) {
13entry:
14  br label %header
15
16header:
17  %counter = phi i32 [ 0, %entry ], [ %counter.footer, %footer ]
18  %break = icmp sge i32 %counter, %bound
19  br i1 %break, label %footer, label %body
20
21body:
22  %counter.next = add i32 %counter, 1
23  br label %footer
24
25footer:
26  %counter.footer = phi i32 [ %counter.next, %body ], [ undef, %header ]
27  br i1 %break, label %end, label %header
28
29end:
30  ret void
31}
32