diff options
| author | Sanjoy Das <sanjoy@playingwithpointers.com> | 2017-09-20 02:31:57 +0000 |
|---|---|---|
| committer | Sanjoy Das <sanjoy@playingwithpointers.com> | 2017-09-20 02:31:57 +0000 |
| commit | 09613b122e011731eb2917ac0106c0ea05e3f556 (patch) | |
| tree | 70f4ff3f790cf5daaef6205262760a8346b371a3 /llvm/lib/Transforms/Scalar | |
| parent | b207d12456782bd04eb06ba8f3d89eb4008d81f6 (diff) | |
| download | bcm5719-llvm-09613b122e011731eb2917ac0106c0ea05e3f556.tar.gz bcm5719-llvm-09613b122e011731eb2917ac0106c0ea05e3f556.zip | |
Tighten the invariants around LoopBase::invalidate
Summary:
With this change:
- Methods in LoopBase trip an assert if the receiver has been invalidated
- LoopBase::clear frees up the memory held the LoopBase instance
This change also shuffles things around as necessary to work with this stricter invariant.
Reviewers: chandlerc
Subscribers: mehdi_amini, mcrosier, llvm-commits
Differential Revision: https://reviews.llvm.org/D38055
llvm-svn: 313708
Diffstat (limited to 'llvm/lib/Transforms/Scalar')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp b/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp index 1008f2c606b..40fcf97d657 100644 --- a/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp +++ b/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp @@ -1045,18 +1045,19 @@ static bool tryToUnrollLoop( UP.Count = TripCount; // Unroll the loop. - if (!UnrollLoop(L, UP.Count, TripCount, UP.Force, UP.Runtime, - UP.AllowExpensiveTripCount, UseUpperBound, MaxOrZero, - TripMultiple, UP.PeelCount, UP.UnrollRemainder, - LI, &SE, &DT, &AC, &ORE, - PreserveLCSSA)) + LoopUnrollStatus UnrollStatus = UnrollLoop( + L, UP.Count, TripCount, UP.Force, UP.Runtime, UP.AllowExpensiveTripCount, + UseUpperBound, MaxOrZero, TripMultiple, UP.PeelCount, UP.UnrollRemainder, + LI, &SE, &DT, &AC, &ORE, PreserveLCSSA); + if (UnrollStatus == LoopUnrollStatus::Unmodified) return false; // If loop has an unroll count pragma or unrolled by explicitly set count // mark loop as unrolled to prevent unrolling beyond that requested. // If the loop was peeled, we already "used up" the profile information // we had, so we don't want to unroll or peel again. - if (IsCountSetExplicitly || UP.PeelCount) + if (UnrollStatus != LoopUnrollStatus::FullyUnrolled && + (IsCountSetExplicitly || UP.PeelCount)) SetLoopAlreadyUnrolled(L); return true; |

