93 lines · plain
1; RUN: llc -O3 %s -o %t.s2; RUN: llc -O3 -stop-after=atomic-expand %s -o %t.mir3; RUN: llc -O3 -start-after=atomic-expand %s -o %t2.s4 5; If we add tti pass correctly files should be identical6; Otherwise LSR will use default TargetTransformInfo and7; optimize the loop differently8; RUN: cmp %t.s %t2.s9 10; Check that we can do the same with unreachable-mbb-elimination pass11; RUN: llc -O3 -stop-after=unreachable-mbb-elimination %s -o %t-mbb-elim.mir12; RUN: llc -O3 -start-after=unreachable-mbb-elimination %t-mbb-elim.mir -o %t3.s13; RUN: cmp %t.s %t3.s14 15; ModuleID = 'loop.c'16source_filename = "loop.c"17target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"18target triple = "aarch64-none-linux-gnu"19 20@q = dso_local local_unnamed_addr global ptr null, align 821 22; Function Attrs: nofree norecurse nounwind23define dso_local i32 @main(i32 %argc, ptr nocapture readnone %argv) local_unnamed_addr #0 {24entry:25 %cmp5 = icmp sgt i32 %argc, 026 br i1 %cmp5, label %for.body.lr.ph, label %for.cond.cleanup27 28for.body.lr.ph: ; preds = %entry29 %0 = load ptr, ptr @q, align 8, !tbaa !230 %1 = zext i32 %argc to i6431 %2 = add nsw i64 %1, -132 %3 = lshr i64 %2, 533 %4 = add nuw nsw i64 %3, 134 %min.iters.check = icmp eq i64 %3, 035 br i1 %min.iters.check, label %for.body.preheader, label %vector.ph36 37for.body.preheader: ; preds = %middle.block, %for.body.lr.ph38 %indvars.iv.ph = phi i64 [ 0, %for.body.lr.ph ], [ %ind.end, %middle.block ]39 br label %for.body40 41vector.ph: ; preds = %for.body.lr.ph42 %n.vec = and i64 %4, 115292150460684697443 %ind.end = shl i64 %n.vec, 544 br label %vector.body45 46vector.body: ; preds = %vector.body, %vector.ph47 %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]48 %offset.idx = shl i64 %index, 549 %induction7 = or i64 %offset.idx, 3250 %5 = getelementptr inbounds i32, ptr %0, i64 %offset.idx51 %6 = getelementptr inbounds i32, ptr %0, i64 %induction752 %7 = trunc i64 %offset.idx to i3253 %8 = trunc i64 %induction7 to i3254 store i32 %7, ptr %5, align 4, !tbaa !655 store i32 %8, ptr %6, align 4, !tbaa !656 %index.next = add i64 %index, 257 %9 = icmp eq i64 %index.next, %n.vec58 br i1 %9, label %middle.block, label %vector.body, !llvm.loop !859 60middle.block: ; preds = %vector.body61 %cmp.n = icmp eq i64 %4, %n.vec62 br i1 %cmp.n, label %for.cond.cleanup, label %for.body.preheader63 64for.cond.cleanup: ; preds = %for.body, %middle.block, %entry65 ret i32 066 67for.body: ; preds = %for.body.preheader, %for.body68 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader ]69 %arrayidx = getelementptr inbounds i32, ptr %0, i64 %indvars.iv70 %10 = trunc i64 %indvars.iv to i3271 store i32 %10, ptr %arrayidx, align 4, !tbaa !672 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 3273 %cmp = icmp ult i64 %indvars.iv.next, %174 br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !1075}76 77attributes #0 = { nofree norecurse nounwind "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="non-leaf" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "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" "use-soft-float"="false" }78 79!llvm.module.flags = !{!0}80!llvm.ident = !{!1}81 82!0 = !{i32 1, !"wchar_size", i32 4}83!1 = !{!"clang version 11.0.0 (https://github.com/llvm/llvm-project.git d9943e7f0ce888733ee7ba91da432e5f01f7aa85)"}84!2 = !{!3, !3, i64 0}85!3 = !{!"any pointer", !4, i64 0}86!4 = !{!"omnipotent char", !5, i64 0}87!5 = !{!"Simple C/C++ TBAA"}88!6 = !{!7, !7, i64 0}89!7 = !{!"int", !4, i64 0}90!8 = distinct !{!8, !9}91!9 = !{!"llvm.loop.isvectorized", i32 1}92!10 = distinct !{!10, !9}93