File: phi-undef.ll

package info (click to toggle)
llvm-toolchain-7 1%3A7.0.1-8~deb9u3
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 733,456 kB
  • sloc: cpp: 3,776,651; ansic: 633,271; asm: 350,301; python: 142,716; objc: 107,612; sh: 22,626; lisp: 11,056; perl: 7,999; pascal: 6,742; ml: 5,537; awk: 3,536; makefile: 2,557; cs: 2,027; xml: 841; ruby: 156
file content (31 lines) | stat: -rw-r--r-- 884 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
; RUN: opt -mtriple=amdgcn-- -analyze -divergence %s | FileCheck %s

; CHECK-LABEL: 'test1':
; CHECK-NEXT: DIVERGENT: i32 %bound
; CHECK: {{^  *}}%counter =
; CHECK-NEXT: DIVERGENT: %break = icmp sge i32 %counter, %bound
; CHECK-NEXT: DIVERGENT: br i1 %break, label %footer, label %body
; CHECK: {{^  *}}%counter.next =
; CHECK: {{^  *}}%counter.footer =
; CHECK: DIVERGENT: br i1 %break, label %end, label %header
; Note: %counter is not divergent!
define amdgpu_ps void @test1(i32 %bound) {
entry:
  br label %header

header:
  %counter = phi i32 [ 0, %entry ], [ %counter.footer, %footer ]
  %break = icmp sge i32 %counter, %bound
  br i1 %break, label %footer, label %body

body:
  %counter.next = add i32 %counter, 1
  br label %footer

footer:
  %counter.footer = phi i32 [ %counter.next, %body ], [ undef, %header ]
  br i1 %break, label %end, label %header

end:
  ret void
}