diff options
author | Andrew Trick <atrick@apple.com> | 2011-07-23 00:33:05 +0000 |
---|---|---|
committer | Andrew Trick <atrick@apple.com> | 2011-07-23 00:33:05 +0000 |
commit | 2045ce154a69b8f251d3a5259324528f0def337b (patch) | |
tree | 2458f26a061c4ae0318e36172ba6b4647a40ed1f /lib/Transforms/Scalar/LoopUnrollPass.cpp | |
parent | ba03377fa171d2340bfff2ec817e62ec09eab992 (diff) | |
download | llvm-2045ce154a69b8f251d3a5259324528f0def337b.tar.gz llvm-2045ce154a69b8f251d3a5259324528f0def337b.tar.bz2 llvm-2045ce154a69b8f251d3a5259324528f0def337b.tar.xz |
Move trip count discovery outside of the generic LoopUnroll helper. This
removes its dependence on canonical induction variables.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135829 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar/LoopUnrollPass.cpp')
-rw-r--r-- | lib/Transforms/Scalar/LoopUnrollPass.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/Transforms/Scalar/LoopUnrollPass.cpp b/lib/Transforms/Scalar/LoopUnrollPass.cpp index 38259f0f24..6d7901f88c 100644 --- a/lib/Transforms/Scalar/LoopUnrollPass.cpp +++ b/lib/Transforms/Scalar/LoopUnrollPass.cpp @@ -137,9 +137,14 @@ bool LoopUnroll::runOnLoop(Loop *L, LPPassManager &LPM) { // Find trip count unsigned TripCount = L->getSmallConstantTripCount(); - unsigned Count = CurrentCount; + + // Find trip multiple if count is not available + unsigned TripMultiple = 1; + if (TripCount == 0) + TripMultiple = L->getSmallConstantTripMultiple(); // Automatically select an unroll count. + unsigned Count = CurrentCount; if (Count == 0) { // Conservative heuristic: if we know the trip count, see if we can // completely unroll (subject to the threshold, checked below); otherwise @@ -183,7 +188,7 @@ bool LoopUnroll::runOnLoop(Loop *L, LPPassManager &LPM) { // Unroll the loop. Function *F = L->getHeader()->getParent(); - if (!UnrollLoop(L, Count, LI, &LPM)) + if (!UnrollLoop(L, Count, TripCount, TripMultiple, LI, &LPM)) return false; // FIXME: Reconstruct dom info, because it is not preserved properly. |