2 ; RUN: opt --passes=loop-vectorize,dce,instcombine --mtriple loongarch64 \
3 ; RUN: -S < %s 2>&1 | FileCheck %s
6 ; CHECK: %{{.*}} = add {{.*}}, 8
8 ; Function Attrs: nofree norecurse nosync nounwind writeonly
9 define dso_local void @foo(i32 signext %n, ptr nocapture %A) local_unnamed_addr #0 {
11 %cmp5 = icmp sgt i32 %n, 0
12 br i1 %cmp5, label %for.body.preheader, label %for.cond.cleanup
14 for.body.preheader: ; preds = %entry
15 %wide.trip.count = zext i32 %n to i64
18 for.cond.cleanup.loopexit: ; preds = %for.body
19 br label %for.cond.cleanup
21 for.cond.cleanup: ; preds = %for.cond.cleanup.loopexit, %entry
24 for.body: ; preds = %for.body.preheader, %for.body
25 %indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.body ]
26 %arrayidx = getelementptr inbounds i32, ptr %A, i64 %indvars.iv
27 %0 = trunc i64 %indvars.iv to i32
28 store i32 %0, ptr %arrayidx, align 4, !tbaa !4
29 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
30 %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
31 br i1 %exitcond.not, label %for.cond.cleanup.loopexit, label %for.body, !llvm.loop !8
35 !5 = !{!"int", !6, i64 0}
36 !6 = !{!"omnipotent char", !7, i64 0}
37 !7 = !{!"Simple C/C++ TBAA"}
38 !8 = distinct !{!8, !9}
39 !9 = !{!"llvm.loop.mustprogress"}