[PATCH] D46044: [LoopUnrollPeel] Fix potentially incorrect invalidation of SCEV in peelLoop
Max Kazantsev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 24 23:45:37 PDT 2018
mkazantsev created this revision.
mkazantsev added reviewers: chandlerc, hfinkel, sanjoy, reames.
Herald added subscribers: javed.absar, zzheng.
Current runtime unrolling invalidates parent loop saying that it might have changed
after the inner loop has changed, but it doesn't bother to do the same to its parents.
With patch https://reviews.llvm.org/rL329047, SCEV becomes much smarter about calculation of exit counts for
outer loops. We might need to invalidate not only the immediate parent, but also
any of its parents as well.
There is no clear evidence that there is some miscompile happening because of this
, but the common sense says that the current code may be wrong.
https://reviews.llvm.org/D46044
Files:
lib/Transforms/Utils/LoopUnrollPeel.cpp
Index: lib/Transforms/Utils/LoopUnrollPeel.cpp
===================================================================
--- lib/Transforms/Utils/LoopUnrollPeel.cpp
+++ lib/Transforms/Utils/LoopUnrollPeel.cpp
@@ -656,9 +656,10 @@
LatchBR->setMetadata(LLVMContext::MD_prof, WeightNode);
}
- // If the loop is nested, we changed the parent loop, update SE.
+ // If the loop is nested, we could have changed any of its parent loops,
+ // update SE.
if (Loop *ParentLoop = L->getParentLoop()) {
- SE->forgetLoop(ParentLoop);
+ SE->forgetTopmostLoop(ParentLoop);
// FIXME: Incrementally update loop-simplify
simplifyLoop(ParentLoop, DT, LI, SE, AC, PreserveLCSSA);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D46044.143864.patch
Type: text/x-patch
Size: 688 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180425/0a4130bf/attachment.bin>
More information about the llvm-commits
mailing list