28 lines · plain
1; REQUIRES: asserts2; RUN: opt < %s -S -passes=loop-unroll -unroll-runtime=true -unroll-allow-remainder=true -unroll-count=43 4; Make sure that the runtime unroll does not break with a non-exiting latch.5define i32 @test(ptr %a, ptr %b, ptr %c, i64 %n) {6entry:7 br label %while.cond8 9while.cond: ; preds = %while.body, %entry10 %i.0 = phi i64 [ 0, %entry ], [ %inc, %while.body ]11 %cmp = icmp slt i64 %i.0, %n12 br i1 %cmp, label %while.body, label %while.end13 14while.body: ; preds = %while.cond15 %arrayidx = getelementptr inbounds i32, ptr %b, i64 %i.016 %0 = load i32, ptr %arrayidx17 %arrayidx1 = getelementptr inbounds i32, ptr %c, i64 %i.018 %1 = load i32, ptr %arrayidx119 %mul = mul nsw i32 %0, %120 %arrayidx2 = getelementptr inbounds i32, ptr %a, i64 %i.021 store i32 %mul, ptr %arrayidx222 %inc = add nsw i64 %i.0, 123 br label %while.cond24 25while.end: ; preds = %while.cond26 ret i32 027}28