diff options
| author | Florian Hahn <flo@fhahn.com> | 2019-09-17 09:02:48 +0000 |
|---|---|---|
| committer | Florian Hahn <flo@fhahn.com> | 2019-09-17 09:02:48 +0000 |
| commit | 1bd58870e5bd715c7bcbd1180bd50c4f4c7663ff (patch) | |
| tree | f33280783df2e189af13a81fc2e0f6a7eebe589b /llvm/lib/Transforms | |
| parent | 505553495c43b963512d7ae33a2aa9fe6769a15f (diff) | |
| download | bcm5719-llvm-1bd58870e5bd715c7bcbd1180bd50c4f4c7663ff.tar.gz bcm5719-llvm-1bd58870e5bd715c7bcbd1180bd50c4f4c7663ff.zip | |
[LoopUnroll] Use LoopSize+1 as threshold, to allow unrolling loops matching LoopSize.
We use `< UP.Threshold` later on, so we should use LoopSize + 1, to
allow unrolling if the result won't exceed to loop size.
Fixes PR43305.
Reviewers: efriedma, dmgreen, paquette
Reviewed By: dmgreen
Differential Revision: https://reviews.llvm.org/D67594
llvm-svn: 372084
Diffstat (limited to 'llvm/lib/Transforms')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp b/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp index d52ce9e815b..244c7d15192 100644 --- a/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp +++ b/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp @@ -1032,10 +1032,10 @@ static LoopUnrollResult tryToUnrollLoop( return LoopUnrollResult::Unmodified; } - // When optimizing for size, use LoopSize as threshold, to (fully) unroll - // loops, if it does not increase code size. + // When optimizing for size, use LoopSize + 1 as threshold (we use < Threshold + // later), to (fully) unroll loops, if it does not increase code size. if (OptForSize) - UP.Threshold = std::max(UP.Threshold, LoopSize); + UP.Threshold = std::max(UP.Threshold, LoopSize + 1); if (NumInlineCandidates != 0) { LLVM_DEBUG(dbgs() << " Not unrolling loop with inlinable calls.\n"); |

