xref: /llvm-project/llvm/test/Transforms/LoopVectorize/vplan-stress-test-no-explict-vf.ll (revision 7d7577256b76e4293f455b8093504d5f7044ab4b)
1; REQUIRES: asserts
2; RUN: opt < %s  -S -passes=loop-vectorize -enable-vplan-native-path -vplan-build-stress-test -debug-only=loop-vectorize -disable-output 2>&1  | FileCheck %s
3
4; This test checks that, when stress testing VPlan, if the computed VF
5; is 1, we override it to VF = 4.
6
7; CHECK: LV: VPlan computed VF 1.
8; CHECK: LV: VPlan stress testing: overriding computed VF.
9; CHECK: LV: Using VF 4 to build VPlans.
10@arr2 = external global [8 x i32], align 16
11@arr = external global [8 x [8 x i32]], align 16
12
13; Function Attrs: norecurse nounwind uwtable
14define void @foo(i32 %n) {
15entry:
16  br label %for.body
17
18for.body:                                         ; preds = %for.inc8, %entry
19  %indvars.iv21 = phi i64 [ 0, %entry ], [ %indvars.iv.next22, %for.inc8 ]
20  %arrayidx = getelementptr inbounds [8 x i32], ptr @arr2, i64 0, i64 %indvars.iv21
21  %0 = trunc i64 %indvars.iv21 to i32
22  store i32 %0, ptr %arrayidx, align 4
23  %1 = trunc i64 %indvars.iv21 to i32
24  %add = add nsw i32 %1, %n
25  br label %for.body3
26
27for.body3:                                        ; preds = %for.body3, %for.body
28  %indvars.iv = phi i64 [ 0, %for.body ], [ %indvars.iv.next, %for.body3 ]
29  %arrayidx7 = getelementptr inbounds [8 x [8 x i32]], ptr @arr, i64 0, i64 %indvars.iv, i64 %indvars.iv21
30  store i32 %add, ptr %arrayidx7, align 4
31  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
32  %exitcond = icmp eq i64 %indvars.iv.next, 8
33  br i1 %exitcond, label %for.inc8, label %for.body3
34
35for.inc8:                                         ; preds = %for.body3
36  %indvars.iv.next22 = add nuw nsw i64 %indvars.iv21, 1
37  %exitcond23 = icmp eq i64 %indvars.iv.next22, 8
38  br i1 %exitcond23, label %for.end10, label %for.body, !llvm.loop !1
39
40for.end10:                                        ; preds = %for.inc8
41  ret void
42}
43
44!1 = distinct !{!1, !2}
45!2 = !{!"llvm.loop.vectorize.enable", i1 true}
46