1 ; RUN: llc -mtriple=r600 -mcpu=redwood -r600-if-convert=0 < %s | FileCheck %s
3 ; This tests for abug where the AMDILCFGStructurizer was crashing on loops
6 ; for (i = 0; i < x; i++) {
19 ; CHECK-LABEL: {{^}}if_inside_loop:
20 ; CHECK: LOOP_START_DX10
22 define amdgpu_kernel void @if_inside_loop(ptr addrspace(1) %out, i32 %a, i32 %b, i32 %c, i32 %d) {
27 %0 = phi i32 [0, %entry], [%inc, %for.inc]
28 %val = phi i32 [0, %entry], [%val.for.inc, %for.inc]
30 %1 = icmp ult i32 10, %a
31 br i1 %1, label %for.inc, label %if.then
34 %2 = icmp ne i32 0, %b
35 br i1 %2, label %if.then.true, label %if.then.false
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
51 %6 = add i32 %a, %val.if
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
60 store i32 %val.for.inc, ptr addrspace(1) %out