diff options
author | Ikhlas Ajbar <iajbar@codeaurora.org> | 2018-03-30 03:05:34 +0000 |
---|---|---|
committer | Ikhlas Ajbar <iajbar@codeaurora.org> | 2018-03-30 03:05:34 +0000 |
commit | 66c8ba5a50ead4fcf4c64c466fbb64cb95d15711 (patch) | |
tree | 83219ebec6bf94be62105ae846dd2484a9607148 /llvm/lib/Transforms/Utils/LoopUnrollPeel.cpp | |
parent | 0934c1998285317313a3d44ab5457be8badcff3f (diff) | |
download | bcm5719-llvm-66c8ba5a50ead4fcf4c64c466fbb64cb95d15711.tar.gz bcm5719-llvm-66c8ba5a50ead4fcf4c64c466fbb64cb95d15711.zip |
peel loops with runtime small trip counts
For Hexagon, peeling loops with small runtime trip count is beneficial for our
benchmarks. We set PeelCount in HexagonTargetInfo.cpp and we use PeelCount set
by the target for computing the desired peel count.
Differential Revision: https://reviews.llvm.org/D44880
llvm-svn: 328854
Diffstat (limited to 'llvm/lib/Transforms/Utils/LoopUnrollPeel.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/LoopUnrollPeel.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Utils/LoopUnrollPeel.cpp b/llvm/lib/Transforms/Utils/LoopUnrollPeel.cpp index 5f465f328b0..cfbecd59af3 100644 --- a/llvm/lib/Transforms/Utils/LoopUnrollPeel.cpp +++ b/llvm/lib/Transforms/Utils/LoopUnrollPeel.cpp @@ -221,6 +221,9 @@ void llvm::computePeelCount(Loop *L, unsigned LoopSize, TargetTransformInfo::UnrollingPreferences &UP, unsigned &TripCount, ScalarEvolution &SE) { assert(LoopSize > 0 && "Zero loop size is not allowed!"); + // Save the UP.PeelCount value set by the target in + // TTI.getUnrollingPreferences or by the flag -unroll-peel-count. + unsigned TargetPeelCount = UP.PeelCount; UP.PeelCount = 0; if (!canPeel(L)) return; @@ -240,7 +243,9 @@ void llvm::computePeelCount(Loop *L, unsigned LoopSize, SmallDenseMap<PHINode *, unsigned> IterationsToInvariance; // Now go through all Phis to calculate their the number of iterations they // need to become invariants. - unsigned DesiredPeelCount = 0; + // Start the max computation with the UP.PeelCount value set by the target + // in TTI.getUnrollingPreferences or by the flag -unroll-peel-count. + unsigned DesiredPeelCount = TargetPeelCount; BasicBlock *BackEdge = L->getLoopLatch(); assert(BackEdge && "Loop is not in simplified form?"); for (auto BI = L->getHeader()->begin(); isa<PHINode>(&*BI); ++BI) { |