diff options
author | Junmo Park <junmoz.park@samsung.com> | 2016-02-16 06:46:58 +0000 |
---|---|---|
committer | Junmo Park <junmoz.park@samsung.com> | 2016-02-16 06:46:58 +0000 |
commit | 6ebdc14cf1b240bbd28c46564d50b7ea1f33ecb3 (patch) | |
tree | a561a9a5328a468ff10bb1fd5f5993828afd1326 /llvm/test/Transforms/LoopUnroll | |
parent | e89a1795987327106de20c781fc841d21b9ce7b4 (diff) | |
download | bcm5719-llvm-6ebdc14cf1b240bbd28c46564d50b7ea1f33ecb3.tar.gz bcm5719-llvm-6ebdc14cf1b240bbd28c46564d50b7ea1f33ecb3.zip |
[SCEVExpander] Make findExistingExpansion smarter
Summary:
Extending findExistingExpansion can use existing value in ExprValueMap.
This patch gives 0.3~0.5% performance improvements on
benchmarks(test-suite, spec2000, spec2006, commercial benchmark)
Reviewers: mzolotukhin, sanjoy, zzheng
Differential Revision: http://reviews.llvm.org/D15559
llvm-svn: 260938
Diffstat (limited to 'llvm/test/Transforms/LoopUnroll')
-rw-r--r-- | llvm/test/Transforms/LoopUnroll/high-cost-trip-count-computation.ll | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/llvm/test/Transforms/LoopUnroll/high-cost-trip-count-computation.ll b/llvm/test/Transforms/LoopUnroll/high-cost-trip-count-computation.ll index 6b1943f13ba..b4f7565c395 100644 --- a/llvm/test/Transforms/LoopUnroll/high-cost-trip-count-computation.ll +++ b/llvm/test/Transforms/LoopUnroll/high-cost-trip-count-computation.ll @@ -24,4 +24,38 @@ loopexit: ; preds = %loop ret i32 0 } +;; Though SCEV for loop tripcount contains division, +;; it shouldn't be considered expensive, since the division already +;; exists in the code and we don't need to expand it once more. +;; Thus, it shouldn't prevent us from unrolling the loop. + +define i32 @test2(i64* %loc, i64 %conv7) { +; CHECK-LABEL: @test2( +; CHECK: udiv +; CHECK: udiv +; CHECK-NOT: udiv +; CHECK-LABEL: for.body.prol +entry: + %rem0 = load i64, i64* %loc, align 8 + %ExpensiveComputation = udiv i64 %rem0, 42 ; <<< Extra computations are added to the trip-count expression + br label %bb1 +bb1: + %div11 = udiv i64 %ExpensiveComputation, %conv7 + %cmp.i38 = icmp ugt i64 %div11, 1 + %div12 = select i1 %cmp.i38, i64 %div11, i64 1 + br label %for.body +for.body: + %rem1 = phi i64 [ %rem0, %bb1 ], [ %rem2, %for.body ] + %k1 = phi i64 [ %div12, %bb1 ], [ %dec, %for.body ] + %mul1 = mul i64 %rem1, 48271 + %rem2 = urem i64 %mul1, 2147483647 + %dec = add i64 %k1, -1 + %cmp = icmp eq i64 %dec, 0 + br i1 %cmp, label %exit, label %for.body +exit: + %rem3 = phi i64 [ %rem2, %for.body ] + store i64 %rem3, i64* %loc, align 8 + ret i32 0 +} + !0 = !{i64 1, i64 100} |