Skip to content

Commit

Permalink
[LoopUnroll] Enable PGO-based loop peeling by default.
Browse files Browse the repository at this point in the history
This enables peeling of loops with low dynamic iteration count by default,
when profile information is available.

Differential Revision: https://reviews.llvm.org/D27734

llvm-svn: 295796
  • Loading branch information
mkuperst committed Feb 22, 2017
1 parent 01fb2c8 commit c2af82b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp
Expand Up @@ -110,7 +110,7 @@ static cl::opt<unsigned> FlatLoopTripCountThreshold(
"aggressively unrolled."));

static cl::opt<bool>
UnrollAllowPeeling("unroll-allow-peeling", cl::Hidden,
UnrollAllowPeeling("unroll-allow-peeling", cl::init(true), cl::Hidden,
cl::desc("Allows loops to be peeled when the dynamic "
"trip count is known to be low."));

Expand Down Expand Up @@ -155,7 +155,7 @@ static TargetTransformInfo::UnrollingPreferences gatherUnrollingPreferences(
UP.AllowExpensiveTripCount = false;
UP.Force = false;
UP.UpperBound = false;
UP.AllowPeeling = false;
UP.AllowPeeling = true;

// Override with any target specific settings
TTI.getUnrollingPreferences(L, UP);
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/Transforms/LoopUnroll/peel-loop-pgo.ll
@@ -1,4 +1,4 @@
; RUN: opt < %s -S -debug-only=loop-unroll -loop-unroll -unroll-allow-peeling 2>&1 | FileCheck %s
; RUN: opt < %s -S -debug-only=loop-unroll -loop-unroll 2>&1 | FileCheck %s
; REQUIRES: asserts

; Make sure we use the profile information correctly to peel-off 3 iterations
Expand Down

0 comments on commit c2af82b

Please sign in to comment.