37 lines · plain
1; RUN: opt -passes=loop-vectorize -mtriple=riscv64 -mattr=+v -S -debug %s 2>&1 | FileCheck %s2 3; REQUIRES: asserts4 5; For %for.1, we are fine initially, because the previous value %for.1.next dominates the6; user of %for.1. But for %for.2, we have to sink the user (%for.1.next) past the previous7; value %for.2.next. This however breaks the condition we have for %for.1. We cannot fix8; both first order recurrences and cannot vectorize the loop.9;10; Make sure we don't compute costs if there are no vector VPlans.11 12; CHECK-NOT: LV: Vector loop of width {{.+}} costs:13;14; CHECK: define i32 @test(15; CHECK-NOT: vector.body16;17define i32 @test(i32 %N) {18entry:19 br label %for.body20 21for.body: ; preds = %for.body.preheader, %for.body22 %iv = phi i32 [ %inc, %for.body ], [ 10, %entry ]23 %for.1 = phi i32 [ %for.1.next, %for.body ], [ 20, %entry ]24 %for.2 = phi i32 [ %for.2.next, %for.body ], [ 11, %entry ]25 %for.1.next = add nsw i32 %for.2, 126 %for.2.next = shl i32 %for.1, 2427 %inc = add nsw i32 %iv, 128 %exitcond = icmp eq i32 %inc, %N29 br i1 %exitcond, label %for.cond1.for.end_crit_edge, label %for.body30 31for.cond1.for.end_crit_edge: ; preds = %for.body32 %add.lcssa = phi i32 [ %for.1.next, %for.body ]33 %sext.lcssa = phi i32 [ %for.2.next, %for.body ]34 %res = add i32 %add.lcssa, %sext.lcssa35 ret i32 %res36}37