[PATCH] D94717: [LoopNest] Consider loop nest with inner loop guard using outer loop induction variable to be perfect
Whitney Tsang via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 29 12:16:21 PDT 2021
Whitney added inline comments.
================
Comment at: llvm/lib/Analysis/LoopInfo.cpp:405
+ // otherwise return nullptr.
+ if (&LoopNest::skipEmptyBlockUntil(ExitFromLatchSucc, GuardOtherSucc) ==
+ GuardOtherSucc)
----------------
bmahjour wrote:
> AFAICS `skipEmptyBlockUntil` doesn't check that the unique successor blocks have unique predecessors. Don't we need to check for that too?
I thought about that too, but it seems to be questionable...
```
if (cond)
goto label;
if (0 < N) {
for (int i = 0; i < N; ++i) {...}
label:
}
```
Should we consider `if (0 < N)` to be a loop guard? It actually guarded the loop, but it is not a single entry single exit region.
If we decided to check for unique predecessor, it may make sense to do it in `skipEmptyBlockUntil`.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D94717/new/
https://reviews.llvm.org/D94717
More information about the llvm-commits
mailing list