blob: da9c3a9391be42de764820c22830163f0dfa6355 [file] [log] [blame]
Nicolai Haehnle13d90f32016-04-14 17:42:47 +00001; RUN: opt -mtriple=amdgcn-- -analyze -divergence %s | FileCheck %s
2
3; CHECK-LABEL: 'test1':
4; CHECK-NEXT: DIVERGENT: i32 %bound
5; CHECK-NEXT: DIVERGENT: %break = icmp sge i32 %counter, %bound
6; CHECK-NEXT: DIVERGENT: br i1 %break, label %footer, label %body
7; CHECK-NEXT: DIVERGENT: br i1 %break, label %end, label %header
8; Note: %counter is not divergent!
9define amdgpu_ps void @test1(i32 %bound) {
10entry:
11 br label %header
12
13header:
14 %counter = phi i32 [ 0, %entry ], [ %counter.footer, %footer ]
15 %break = icmp sge i32 %counter, %bound
16 br i1 %break, label %footer, label %body
17
18body:
19 %counter.next = add i32 %counter, 1
20 br label %footer
21
22footer:
23 %counter.footer = phi i32 [ %counter.next, %body ], [ undef, %header ]
24 br i1 %break, label %end, label %header
25
26end:
27 ret void
28}