1; RUN: opt -S -mtriple=aarch64 -passes=loop-vectorize -force-vector-width=2 < %s | FileCheck %s 2target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128" 3target triple = "aarch64--linux-gnu" 4 5@b = common local_unnamed_addr global i32 0, align 4 6@a = common local_unnamed_addr global ptr null, align 8 7 8define i32 @fn1() local_unnamed_addr #0 { 9; We expect the backend to expand all reductions. 10; CHECK: @llvm.vector.reduce 11entry: 12 %0 = load i32, ptr @b, align 4, !tbaa !1 13 %cmp40 = icmp sgt i32 %0, 0 14 br i1 %cmp40, label %for.body.lr.ph, label %for.end 15 16for.body.lr.ph: ; preds = %entry 17 %1 = load ptr, ptr @a, align 8, !tbaa !5 18 %2 = load i32, ptr @b, align 4, !tbaa !1 19 %3 = sext i32 %2 to i64 20 br label %for.body 21 22for.body: ; preds = %for.body.lr.ph, %for.body 23 %indvars.iv = phi i64 [ 0, %for.body.lr.ph ], [ %indvars.iv.next, %for.body ] 24 %d.043 = phi i16 [ undef, %for.body.lr.ph ], [ %.sink28, %for.body ] 25 %c.042 = phi i16 [ undef, %for.body.lr.ph ], [ %c.0., %for.body ] 26 %arrayidx = getelementptr inbounds i16, ptr %1, i64 %indvars.iv 27 %4 = load i16, ptr %arrayidx, align 2, !tbaa !7 28 %cmp2 = icmp sgt i16 %c.042, %4 29 %c.0. = select i1 %cmp2, i16 %c.042, i16 %4 30 %cmp13 = icmp slt i16 %d.043, %4 31 %.sink28 = select i1 %cmp13, i16 %d.043, i16 %4 32 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 33 %cmp = icmp slt i64 %indvars.iv.next, %3 34 br i1 %cmp, label %for.body, label %for.end 35 36for.end: ; preds = %for.body, %entry 37 %c.0.lcssa = phi i16 [ undef, %entry ], [ %c.0., %for.body ] 38 %d.0.lcssa = phi i16 [ undef, %entry ], [ %.sink28, %for.body ] 39 %cmp26 = icmp sgt i16 %c.0.lcssa, %d.0.lcssa 40 %conv27 = zext i1 %cmp26 to i32 41 ret i32 %conv27 42} 43 44attributes #0 = { norecurse nounwind readonly "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="generic" "target-features"="+neon" "unsafe-fp-math"="false" "use-soft-float"="false" } 45!llvm.ident = !{!0} 46 47!0 = !{!"clang"} 48!1 = !{!2, !2, i64 0} 49!2 = !{!"int", !3, i64 0} 50!3 = !{!"omnipotent char", !4, i64 0} 51!4 = !{!"Simple C/C++ TBAA"} 52!5 = !{!6, !6, i64 0} 53!6 = !{!"any pointer", !3, i64 0} 54!7 = !{!8, !8, i64 0} 55!8 = !{!"short", !3, i64 0} 56