[PATCH] D91682: [LoopInterchange] Fix the checking of tightly nested loop
Whitney Tsang via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 1 04:55:44 PST 2020
Whitney added inline comments.
================
Comment at: llvm/lib/Transforms/Scalar/LoopInterchange.cpp:587
-bool LoopInterchangeLegality::tightlyNested(Loop *OuterLoop, Loop *InnerLoop) {
- BasicBlock *OuterLoopHeader = OuterLoop->getHeader();
- BasicBlock *InnerLoopPreHeader = InnerLoop->getLoopPreheader();
- BasicBlock *OuterLoopLatch = OuterLoop->getLoopLatch();
+bool LoopInterchangeLegality::tightlyNested(Loop *ParentLoop, Loop *ChildLoop) {
+ BasicBlock *ParentLoopHeader = ParentLoop->getHeader();
----------------
Is there a reason to rename Outer->Parent and Inner->Child? As all the comments still use the term inner and outer to reference the loops.
================
Comment at: llvm/lib/Transforms/Scalar/LoopInterchange.cpp:1006
// Check if the loops are tightly nested.
- if (!tightlyNested(OuterLoop, InnerLoop)) {
- LLVM_DEBUG(dbgs() << "Loops not tightly nested\n");
- ORE->emit([&]() {
- return OptimizationRemarkMissed(DEBUG_TYPE, "NotTightlyNested",
- InnerLoop->getStartLoc(),
- InnerLoop->getHeader())
- << "Cannot interchange loops because they are not tightly "
- "nested.";
- });
- return false;
- }
+ Loop *ChildLoop = InnerLoop;
+ Loop *ParentLoop = nullptr;
----------------
processLoop is called with loop i and i -1, so there are no loops in between InnerLoop and OuterLoop.
Am I missing something?
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D91682/new/
https://reviews.llvm.org/D91682
More information about the llvm-commits
mailing list