aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Utils/LoopUnrollPeel.cpp
diff options
context:
space:
mode:
authorArkady Shlykov <arkady.shlykov@intel.com>2020-01-15 06:12:34 -0800
committerArkady Shlykov <arkady.shlykov@intel.com>2020-01-15 08:25:21 -0800
commit3f3017e162ec4208399dcf633c99bdac788c06fd (patch)
tree88f6ff0fd3206144304610ceaeb183bc5f058c59 /llvm/lib/Transforms/Utils/LoopUnrollPeel.cpp
parent3180af4362be22d416464f5f3700c456b2f124b9 (diff)
downloadllvm-3f3017e162ec4208399dcf633c99bdac788c06fd.zip
llvm-3f3017e162ec4208399dcf633c99bdac788c06fd.tar.gz
llvm-3f3017e162ec4208399dcf633c99bdac788c06fd.tar.bz2
[Loop Peeling] Add possibility to enable peeling on loop nests.
Summary: Current peeling implementation bails out in case of loop nests. The patch introduces a field in TargetTransformInfo structure that certain targets can use to relax the constraints if it's profitable (disabled by default). Also additional option is added to enable peeling manually for experimenting and testing purposes. Reviewers: fhahn, lebedev.ri, xbolva00 Reviewed By: xbolva00 Subscribers: xbolva00, hiraditya, zzheng, llvm-commits Differential Revision: https://reviews.llvm.org/D70304
Diffstat (limited to 'llvm/lib/Transforms/Utils/LoopUnrollPeel.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/LoopUnrollPeel.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Utils/LoopUnrollPeel.cpp b/llvm/lib/Transforms/Utils/LoopUnrollPeel.cpp
index 7a168ff..cdf4826 100644
--- a/llvm/lib/Transforms/Utils/LoopUnrollPeel.cpp
+++ b/llvm/lib/Transforms/Utils/LoopUnrollPeel.cpp
@@ -289,8 +289,10 @@ void llvm::computePeelCount(Loop *L, unsigned LoopSize,
if (!canPeel(L))
return;
- // Only try to peel innermost loops.
- if (!L->empty())
+ // Only try to peel innermost loops by default.
+ // The constraint can be relaxed by the target in TTI.getUnrollingPreferences
+ // or by the flag -unroll-allow-loop-nests-peeling.
+ if (!UP.AllowLoopNestsPeeling && !L->empty())
return;
// If the user provided a peel count, use that.