diff options
author | Florian Hahn <flo@fhahn.com> | 2019-02-14 13:59:39 +0000 |
---|---|---|
committer | Florian Hahn <flo@fhahn.com> | 2019-02-14 13:59:39 +0000 |
commit | 6ab83b7db642050db27c0734f89edd309da0e641 (patch) | |
tree | 72dcf8793ca96307586da8249ce2eacfd59ec639 /llvm/lib/Transforms/Utils | |
parent | 2d874e53561c749fde6efa51650bb0c49d89851a (diff) | |
download | bcm5719-llvm-6ab83b7db642050db27c0734f89edd309da0e641.tar.gz bcm5719-llvm-6ab83b7db642050db27c0734f89edd309da0e641.zip |
[LoopUnrollPeel] Add case where we should forget the peeled loop from SCEV.
The test case requires the peeled loop to be forgotten after peeling,
even though it does not have a parent. When called via the unroller,
SE->forgetTopmostLoop is also called, so the test case would also pass
without any SCEV invalidation, but peelLoop is exposed as utility
function. Also, in the test case, simplifyLoop will make changes,
removing the loop from SCEV, but it is better to not rely on this
behavior.
Reviewers: sanjoy, mkazantsev
Reviewed By: mkazantsev
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D58192
llvm-svn: 354031
Diffstat (limited to 'llvm/lib/Transforms/Utils')
-rw-r--r-- | llvm/lib/Transforms/Utils/LoopUnrollPeel.cpp | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/llvm/lib/Transforms/Utils/LoopUnrollPeel.cpp b/llvm/lib/Transforms/Utils/LoopUnrollPeel.cpp index f893921aca3..fca05b7b6f2 100644 --- a/llvm/lib/Transforms/Utils/LoopUnrollPeel.cpp +++ b/llvm/lib/Transforms/Utils/LoopUnrollPeel.cpp @@ -664,16 +664,14 @@ bool llvm::peelLoop(Loop *L, unsigned PeelCount, LoopInfo *LI, LatchBR->setMetadata(LLVMContext::MD_prof, WeightNode); } - // If the loop is nested, we changed the parent loop, update SE. - if (Loop *ParentLoop = L->getParentLoop()) { - SE->forgetLoop(ParentLoop); - - // FIXME: Incrementally update loop-simplify - simplifyLoop(ParentLoop, DT, LI, SE, AC, PreserveLCSSA); - } else { - // FIXME: Incrementally update loop-simplify - simplifyLoop(L, DT, LI, SE, AC, PreserveLCSSA); - } + if (Loop *ParentLoop = L->getParentLoop()) + L = ParentLoop; + + // We modified the loop, update SE. + SE->forgetTopmostLoop(L); + + // FIXME: Incrementally update loop-simplify + simplifyLoop(L, DT, LI, SE, AC, PreserveLCSSA); NumPeeled++; |