File: structurize1.ll

package info (click to toggle)
llvm-toolchain-17 1%3A17.0.6-22
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,799,624 kB
  • sloc: cpp: 6,428,607; ansic: 1,383,196; asm: 793,408; python: 223,504; objc: 75,364; f90: 60,502; lisp: 33,869; pascal: 15,282; sh: 9,684; perl: 7,453; ml: 4,937; awk: 3,523; makefile: 2,889; javascript: 2,149; xml: 888; fortran: 619; cs: 573
file content (62 lines) | stat: -rw-r--r-- 1,317 bytes parent folder | download | duplicates (4)
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
; RUN: llc -march=r600 -mcpu=redwood -r600-if-convert=0 < %s | FileCheck %s

; This tests for abug where the AMDILCFGStructurizer was crashing on loops
; like this:
;
; for (i = 0; i < x; i++) {
;   if (cond0) {
;     if (cond1) {
;
;     } else {
;
;     }
;     if (cond2) {
;
;     }
;   }
; }

; CHECK-LABEL: {{^}}if_inside_loop:
; CHECK: LOOP_START_DX10
; CHECK: END_LOOP
define amdgpu_kernel void @if_inside_loop(ptr addrspace(1) %out, i32 %a, i32 %b, i32 %c, i32 %d) {
entry:
  br label %for.body

for.body:
  %0 = phi i32 [0, %entry], [%inc, %for.inc]
  %val = phi i32 [0, %entry], [%val.for.inc, %for.inc]
  %inc = add i32 %0, 1
  %1 = icmp ult i32 10, %a
  br i1 %1, label %for.inc, label %if.then

if.then:
  %2 = icmp ne i32 0, %b
  br i1 %2, label %if.then.true, label %if.then.false

if.then.true:
  %3 = add i32 %a, %val
  br label %if

if.then.false:
  %4 = mul i32 %a, %val
  br label %if

if:
  %val.if = phi i32 [%3, %if.then.true], [%4, %if.then.false]
  %5 = icmp ne i32 0, %c
  br i1 %5, label %if.true, label %for.inc

if.true:
  %6 = add i32 %a, %val.if
  br label %for.inc

for.inc:
  %val.for.inc = phi i32 [%val, %for.body], [%val.if, %if], [%6, %if.true]
  %7 = icmp ne i32 0, %d
  br i1 %7, label %for.body, label %exit

exit:
  store i32 %val.for.inc, ptr addrspace(1) %out
  ret void
}