diff options
author | David L Kreitzer <david.l.kreitzer@intel.com> | 2016-04-05 12:19:35 +0000 |
---|---|---|
committer | David L Kreitzer <david.l.kreitzer@intel.com> | 2016-04-05 12:19:35 +0000 |
commit | 188de5ae69402c84ac40b2d5aed587b8454c75a8 (patch) | |
tree | 10b82140b6ba036e96c8d7e292b443c0d2d4ab31 /llvm/lib/Transforms/Utils/LoopUnroll.cpp | |
parent | 849045f2aaa5302f931b4fea3448d7af76e6b4f0 (diff) | |
download | llvm-188de5ae69402c84ac40b2d5aed587b8454c75a8.zip llvm-188de5ae69402c84ac40b2d5aed587b8454c75a8.tar.gz llvm-188de5ae69402c84ac40b2d5aed587b8454c75a8.tar.bz2 |
Adds the ability to use an epilog remainder loop during loop unrolling and makes
this the default behavior.
Patch by Evgeny Stupachenko (evstupac@gmail.com).
Differential Revision: http://reviews.llvm.org/D18158
llvm-svn: 265388
Diffstat (limited to 'llvm/lib/Transforms/Utils/LoopUnroll.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/LoopUnroll.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/Utils/LoopUnroll.cpp b/llvm/lib/Transforms/Utils/LoopUnroll.cpp index 8460098..20822df 100644 --- a/llvm/lib/Transforms/Utils/LoopUnroll.cpp +++ b/llvm/lib/Transforms/Utils/LoopUnroll.cpp @@ -44,6 +44,11 @@ using namespace llvm; STATISTIC(NumCompletelyUnrolled, "Number of loops completely unrolled"); STATISTIC(NumUnrolled, "Number of loops unrolled (completely or otherwise)"); +static cl::opt<bool> +UnrollRuntimeEpilog("unroll-runtime-epilog", cl::init(true), cl::Hidden, + cl::desc("Allow runtime unrolled loops to be unrolled " + "with epilog instead of prolog.")); + /// Convert the instruction operands from referencing the current values into /// those specified by VMap. static inline void remapInstruction(Instruction *I, @@ -288,12 +293,13 @@ bool llvm::UnrollLoop(Loop *L, unsigned Count, unsigned TripCount, "convergent " "operation."); }); - // Don't output the runtime loop prolog if Count is a multiple of - // TripMultiple. Such a prolog is never needed, and is unsafe if the loop + // Don't output the runtime loop remainder if Count is a multiple of + // TripMultiple. Such a remainder is never needed, and is unsafe if the loop // contains a convergent instruction. if (RuntimeTripCount && TripMultiple % Count != 0 && - !UnrollRuntimeLoopProlog(L, Count, AllowExpensiveTripCount, LI, SE, DT, - PreserveLCSSA)) + !UnrollRuntimeLoopRemainder(L, Count, AllowExpensiveTripCount, + UnrollRuntimeEpilog, LI, SE, DT, + PreserveLCSSA)) return false; // Notify ScalarEvolution that the loop will be substantially changed, |