63 lines · plain
1; RUN: llc -mtriple=r600 -mcpu=redwood -r600-if-convert=0 < %s | FileCheck %s2 3; This tests for abug where the AMDILCFGStructurizer was crashing on loops4; 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_DX1021; CHECK: END_LOOP22define amdgpu_kernel void @if_inside_loop(ptr addrspace(1) %out, i32 %a, i32 %b, i32 %c, i32 %d) {23entry:24 br label %for.body25 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, 130 %1 = icmp ult i32 10, %a31 br i1 %1, label %for.inc, label %if.then32 33if.then:34 %2 = icmp ne i32 0, %b35 br i1 %2, label %if.then.true, label %if.then.false36 37if.then.true:38 %3 = add i32 %a, %val39 br label %if40 41if.then.false:42 %4 = mul i32 %a, %val43 br label %if44 45if:46 %val.if = phi i32 [%3, %if.then.true], [%4, %if.then.false]47 %5 = icmp ne i32 0, %c48 br i1 %5, label %if.true, label %for.inc49 50if.true:51 %6 = add i32 %a, %val.if52 br label %for.inc53 54for.inc:55 %val.for.inc = phi i32 [%val, %for.body], [%val.if, %if], [%6, %if.true]56 %7 = icmp ne i32 0, %d57 br i1 %7, label %for.body, label %exit58 59exit:60 store i32 %val.for.inc, ptr addrspace(1) %out61 ret void62}63