[PATCH] D30632: [LoopUnrolling] Fix loop size check for peeling
Max Kazantsev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Mar 5 20:35:00 PST 2017
mkazantsev created this revision.
We should check if loop size allows us to peel at least one iteration before we do so.
https://reviews.llvm.org/D30632
Files:
lib/Transforms/Utils/LoopUnrollPeel.cpp
Index: lib/Transforms/Utils/LoopUnrollPeel.cpp
===================================================================
--- lib/Transforms/Utils/LoopUnrollPeel.cpp
+++ lib/Transforms/Utils/LoopUnrollPeel.cpp
@@ -71,6 +71,10 @@
if (!L->empty())
return;
+ // Can we peel at least one iteration?
+ if (LoopSize > UP.Threshold)
+ return;
+
// Try to find a Phi node that has the same loop invariant as an input from
// its only back edge. If there is such Phi, peeling 1 iteration from the
// loop is profitable, because starting from 2nd iteration we will have an
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D30632.90640.patch
Type: text/x-patch
Size: 580 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170306/86b2e173/attachment.bin>
More information about the llvm-commits
mailing list