42 lines · plain
1; RUN: opt < %s -S -passes=loop-unroll -mtriple aarch64 -mcpu=cortex-a57 -unroll-runtime-epilog=true | FileCheck %s -check-prefix=EPILOG2; RUN: opt < %s -S -passes=loop-unroll -mtriple aarch64 -mcpu=cortex-a57 -unroll-runtime-epilog=false | FileCheck %s -check-prefix=PROLOG3; RUN: opt < %s -S -passes=loop-unroll -mtriple aarch64 -mcpu=cortex-r82 -unroll-runtime-epilog=true | FileCheck %s -check-prefix=EPILOG4; RUN: opt < %s -S -passes=loop-unroll -mtriple aarch64 -mcpu=cortex-r82 -unroll-runtime-epilog=false | FileCheck %s -check-prefix=PROLOG5 6; Tests for unrolling loops with run-time trip counts7 8; EPILOG: %xtraiter = and i32 %n9; EPILOG: for.body:10; EPILOG: %lcmp.mod = icmp ne i32 %xtraiter, 011; EPILOG: br i1 %lcmp.mod, label %for.body.epil.preheader, label %for.end.loopexit12; EPILOG: for.body.epil:13 14; PROLOG: %xtraiter = and i32 %n15; PROLOG: %lcmp.mod = icmp ne i32 %xtraiter, 016; PROLOG: br i1 %lcmp.mod, label %for.body.prol.preheader, label %for.body.prol.loopexit17; PROLOG: for.body.prol:18; PROLOG: for.body:19 20define i32 @test(ptr nocapture %a, i32 %n) nounwind uwtable readonly {21entry:22 %cmp1 = icmp eq i32 %n, 023 br i1 %cmp1, label %for.end, label %for.body24 25for.body: ; preds = %for.body, %entry26 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]27 %sum.02 = phi i32 [ %add, %for.body ], [ 0, %entry ]28 %arrayidx = getelementptr inbounds i32, ptr %a, i64 %indvars.iv29 %0 = load i32, ptr %arrayidx, align 430 %add = add nsw i32 %0, %sum.0231 %indvars.iv.next = add i64 %indvars.iv, 132 %lftr.wideiv = trunc i64 %indvars.iv.next to i3233 %exitcond = icmp eq i32 %lftr.wideiv, %n34 br i1 %exitcond, label %for.end, label %for.body35 36for.end: ; preds = %for.body, %entry37 %sum.0.lcssa = phi i32 [ 0, %entry ], [ %add, %for.body ]38 ret i32 %sum.0.lcssa39}40 41 42