2 ; RUN: opt < %s -passes='loop-vectorize' -debug-only=loop-vectorize -S 2>&1 | FileCheck %s
4 target datalayout = "e-m:e-i64:64-n32:64-S128-v256:256:256-v512:512:512"
6 ; CHECK: LV: Checking a loop in "f1"
7 ; CHECK: LV: Loop hints: force=? width=0 interleave=1
8 define dso_local void @f1(i32 signext %n, i32* %A) {
10 %cmp1 = icmp sgt i32 %n, 0
11 br i1 %cmp1, label %for.body.preheader, label %for.end
13 for.body.preheader: ; preds = %entry
14 %wide.trip.count = zext i32 %n to i64
17 for.body: ; preds = %for.body.preheader, %for.body
18 %indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.body ]
19 %arrayidx = getelementptr inbounds i32, i32* %A, i64 %indvars.iv
20 %0 = trunc i64 %indvars.iv to i32
21 store i32 %0, i32* %arrayidx, align 4
22 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
23 %exitcond = icmp ne i64 %indvars.iv.next, %wide.trip.count
24 br i1 %exitcond, label %for.body, label %for.end.loopexit, !llvm.loop !1
26 for.end.loopexit: ; preds = %for.body
29 for.end: ; preds = %for.end.loopexit, %entry
33 ; CHECK: LV: Checking a loop in "f2"
34 ; CHECK: LV: Loop hints: force=? width=0 interleave=4
35 define dso_local void @f2(i32 signext %n, i32* %A) {
37 %cmp1 = icmp sgt i32 %n, 0
38 br i1 %cmp1, label %for.body.preheader, label %for.end
40 for.body.preheader: ; preds = %entry
41 %wide.trip.count = zext i32 %n to i64
44 for.body: ; preds = %for.body.preheader, %for.body
45 %indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.body ]
46 %arrayidx = getelementptr inbounds i32, i32* %A, i64 %indvars.iv
47 %0 = trunc i64 %indvars.iv to i32
48 store i32 %0, i32* %arrayidx, align 4
49 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
50 %exitcond = icmp ne i64 %indvars.iv.next, %wide.trip.count
51 br i1 %exitcond, label %for.body, label %for.end.loopexit, !llvm.loop !3
53 for.end.loopexit: ; preds = %for.body
56 for.end: ; preds = %for.end.loopexit, %entry
60 ; CHECK: LV: Checking a loop in "f3"
61 ; CHECK: LV: Loop hints: force=? width=0 interleave=1
62 define dso_local void @f3(i32 signext %n, i32* %A) {
64 %cmp1 = icmp sgt i32 %n, 0
65 br i1 %cmp1, label %for.body.preheader, label %for.end
67 for.body.preheader: ; preds = %entry
68 %wide.trip.count = zext i32 %n to i64
71 for.body: ; preds = %for.body.preheader, %for.body
72 %indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.body ]
73 %arrayidx = getelementptr inbounds i32, i32* %A, i64 %indvars.iv
74 %0 = trunc i64 %indvars.iv to i32
75 store i32 %0, i32* %arrayidx, align 4
76 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
77 %exitcond = icmp ne i64 %indvars.iv.next, %wide.trip.count
78 br i1 %exitcond, label %for.body, label %for.end.loopexit, !llvm.loop !6
80 for.end.loopexit: ; preds = %for.body
83 for.end: ; preds = %for.end.loopexit, %entry
87 !1 = distinct !{!1, !2}
88 !2 = !{!"llvm.loop.unroll.disable"}
89 !3 = distinct !{!3, !4, !5}
90 !4 = !{!"llvm.loop.unroll.disable"}
91 !5 = !{!"llvm.loop.interleave.count", i32 4}
92 !6 = distinct !{!6, !7, !8}
93 !7 = !{!"llvm.loop.mustprogress"}
94 !8 = !{!"llvm.loop.unroll.count", i32 1}