brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.9 KiB · 69a7fac Raw
38 lines · plain
1; RUN: opt < %s -S -unroll-partial-threshold=20 -unroll-threshold=20 -passes=loop-unroll -unroll-allow-partial -unroll-runtime -unroll-allow-remainder -unroll-max-percent-threshold-boost=100 | FileCheck %s2; RUN: opt < %s -S -passes='require<opt-remark-emit>,loop-unroll' -unroll-partial-threshold=20 -unroll-threshold=20 -unroll-allow-partial -unroll-runtime -unroll-allow-remainder -unroll-max-percent-threshold-boost=100 | FileCheck %s3;4; Also check that the simple unroller doesn't allow the partial unrolling.5; RUN: opt < %s -S -passes='require<opt-remark-emit>,loop(loop-unroll-full)' -unroll-partial-threshold=20 -unroll-threshold=20 -unroll-allow-partial -unroll-runtime -unroll-allow-remainder -unroll-max-percent-threshold-boost=100 | FileCheck %s --check-prefix=CHECK-NO-UNROLL6 7; The Loop TripCount is 9. However unroll factors 3 or 9 exceed given threshold.8; The test checks that we choose a smaller, power-of-two, unroll count and do not give up on unrolling.9 10; CHECK: for.body:11; CHECK: store12; CHECK: for.body.1:13; CHECK: store14 15; CHECK-NO-UNROLL: for.body:16; CHECK-NO-UNROLL: store17; CHECK-NO-UNROLL-NOT: store18 19define void @foo(ptr nocapture %a, ptr nocapture readonly %b) nounwind uwtable {20entry:21  br label %for.body22 23for.body:                                         ; preds = %for.body, %entry24  %indvars.iv = phi i64 [ 1, %entry ], [ %indvars.iv.next, %for.body ]25  %arrayidx = getelementptr inbounds i32, ptr %b, i64 %indvars.iv26  %ld = load i32, ptr %arrayidx, align 427  %idxprom1 = sext i32 %ld to i6428  %arrayidx2 = getelementptr inbounds i32, ptr %a, i64 %idxprom129  %st = trunc i64 %indvars.iv to i3230  store i32 %st, ptr %arrayidx2, align 431  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 132  %exitcond = icmp eq i64 %indvars.iv.next, 2033  br i1 %exitcond, label %for.end, label %for.body34 35for.end:                                          ; preds = %for.body36  ret void37}38