2 ; RUN: opt -passes=loop-vectorize,dce,instcombine -mtriple riscv64-linux-gnu \
3 ; RUN: -mattr=+v -debug-only=loop-vectorize \
4 ; RUN: -riscv-v-vector-bits-min=128 -scalable-vectorization=off -S < %s 2>&1 | FileCheck %s
8 ; CHECK: %{{.*}} = add <8 x i32> %{{.*}}, <i32 8, i32 8, i32 8, i32 8, i32 8, i32 8, i32 8, i32 8>
9 ; CHECK: %{{.*}} = add {{.*}}, 16
11 ; Function Attrs: nofree norecurse nosync nounwind writeonly
12 define dso_local void @foo(i32 signext %n, ptr nocapture %A) local_unnamed_addr #0 {
14 %cmp5 = icmp sgt i32 %n, 0
15 br i1 %cmp5, label %for.body.preheader, label %for.cond.cleanup
17 for.body.preheader: ; preds = %entry
18 %wide.trip.count = zext i32 %n to i64
21 for.cond.cleanup.loopexit: ; preds = %for.body
22 br label %for.cond.cleanup
24 for.cond.cleanup: ; preds = %for.cond.cleanup.loopexit, %entry
27 for.body: ; preds = %for.body.preheader, %for.body
28 %indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.body ]
29 %arrayidx = getelementptr inbounds i32, ptr %A, i64 %indvars.iv
30 %0 = trunc i64 %indvars.iv to i32
31 store i32 %0, ptr %arrayidx, align 4, !tbaa !4
32 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
33 %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
34 br i1 %exitcond.not, label %for.cond.cleanup.loopexit, label %for.body, !llvm.loop !8
37 attributes #0 = { nofree norecurse nosync nounwind writeonly "frame-pointer"="none" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+64bit,+a,+c,+m,+relax,-save-restore" }
39 !llvm.module.flags = !{!0, !1, !2}
42 !0 = !{i32 1, !"wchar_size", i32 4}
43 !1 = !{i32 1, !"target-abi", !"lp64"}
44 !2 = !{i32 8, !"SmallDataLimit", i32 8}
45 !3 = !{!"clang version 13.0.0"}
47 !5 = !{!"int", !6, i64 0}
48 !6 = !{!"omnipotent char", !7, i64 0}
49 !7 = !{!"Simple C/C++ TBAA"}
50 !8 = distinct !{!8, !9}
51 !9 = !{!"llvm.loop.mustprogress"}