• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc -march=r600 -mcpu=redwood -r600-if-convert=0 < %s | FileCheck %s
2
3; This tests for abug where the AMDILCFGStructurizer was crashing on loops
4; like this:
5;
6; for (i = 0; i < x; i++) {
7;   if (cond0) {
8;     if (cond1) {
9;
10;     } else {
11;
12;     }
13;     if (cond2) {
14;
15;     }
16;   }
17; }
18
19; CHECK-LABEL: {{^}}if_inside_loop:
20; CHECK: LOOP_START_DX10
21; CHECK: END_LOOP
22define void @if_inside_loop(i32 addrspace(1)* %out, i32 %a, i32 %b, i32 %c, i32 %d) {
23entry:
24  br label %for.body
25
26for.body:
27  %0 = phi i32 [0, %entry], [%inc, %for.inc]
28  %val = phi i32 [0, %entry], [%val.for.inc, %for.inc]
29  %inc = add i32 %0, 1
30  %1 = icmp ult i32 10, %a
31  br i1 %1, label %for.inc, label %if.then
32
33if.then:
34  %2 = icmp ne i32 0, %b
35  br i1 %2, label %if.then.true, label %if.then.false
36
37if.then.true:
38  %3 = add i32 %a, %val
39  br label %if
40
41if.then.false:
42  %4 = mul i32 %a, %val
43  br label %if
44
45if:
46  %val.if = phi i32 [%3, %if.then.true], [%4, %if.then.false]
47  %5 = icmp ne i32 0, %c
48  br i1 %5, label %if.true, label %for.inc
49
50if.true:
51  %6 = add i32 %a, %val.if
52  br label %for.inc
53
54for.inc:
55  %val.for.inc = phi i32 [%val, %for.body], [%val.if, %if], [%6, %if.true]
56  %7 = icmp ne i32 0, %d
57  br i1 %7, label %for.body, label %exit
58
59exit:
60  store i32 %val.for.inc, i32 addrspace(1)* %out
61  ret void
62}
63