diff options
| author | Fiona Glaser <escha@apple.com> | 2016-04-06 16:43:45 +0000 |
|---|---|---|
| committer | Fiona Glaser <escha@apple.com> | 2016-04-06 16:43:45 +0000 |
| commit | 16332ba861f9266a43ebabf5068e7e9091202870 (patch) | |
| tree | 7dd45943eeed62ae95d0b338fedeb76f31036dc1 /llvm/lib/Transforms | |
| parent | 2cce7b728b88d846713f8f1e69f9cc58623024c2 (diff) | |
| download | bcm5719-llvm-16332ba861f9266a43ebabf5068e7e9091202870.tar.gz bcm5719-llvm-16332ba861f9266a43ebabf5068e7e9091202870.zip | |
LoopUnroll: only allow non-modulo Partial unrolling when Runtime=true
Patch by Evgeny Stupachenko <evstupac@gmail.com>.
llvm-svn: 265558
Diffstat (limited to 'llvm/lib/Transforms')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp b/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp index fa6214f89f0..e5a95135891 100644 --- a/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp +++ b/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp @@ -639,10 +639,12 @@ static bool tryToUnrollLoop(Loop *L, DominatorTree &DT, LoopInfo *LI, Count = (std::max(UP.PartialThreshold, 3u) - 2) / (LoopSize - 2); while (Count != 0 && TripCount % Count != 0) Count--; - if (Count <= 1) { + if (AllowRuntime && Count <= 1) { // If there is no Count that is modulo of TripCount, set Count to // largest power-of-two factor that satisfies the threshold limit. - Count = (std::max(UP.PartialThreshold, 3u) - 2) / (LoopSize - 2); + // As we'll create fixup loop, do the type of unrolling only if + // runtime unrolling is allowed. + Count = DefaultUnrollRuntimeCount; UnrolledSize = (LoopSize - 2) * Count + 2; while (Count != 0 && UnrolledSize > UP.PartialThreshold) { Count >>= 1; |

