[PATCH] D68789: [LoopNest]: Analysis to discover properties of a loop nest.
Michael Kruse via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 17 09:26:56 PST 2020
Meinersbur accepted this revision.
Meinersbur added a comment.
This revision is now accepted and ready to land.
LGTM
================
Comment at: llvm/include/llvm/Analysis/LoopNestAnalysis.h:34-35
+
+ /// Return true if the given loops \p OuterLoop and \p InnerLoop are
+ /// perfectly nested with respect to each other, and false otherwise.
+ static bool arePerfectlyNested(const Loop &OuterLoop, const Loop &InnerLoop,
----------------
etiotto wrote:
> Meinersbur wrote:
> > Could you clarify whether this allows other perfectly nested loops between outer and inner? Eg.
> > ```
> > for outer:
> > for middle:
> > for inner:
> > ```
> >
> Added example in a comment.
What I meant is what does it return for:
```
for i
for j
for k
```
`arePerfectlyNested(loop_i, loop_k, SE) == ?`
================
Comment at: llvm/include/llvm/Analysis/LoopNestAnalysis.h:86
+ /// Return the number of loops in the nest.
+ unsigned getNumLoops() const { return Loops.size(); }
+
----------------
[style] `SmallVector::size()` is of type `size_t`, why not also return `size_t`?
================
Comment at: llvm/include/llvm/Analysis/LoopNestAnalysis.h:113
+ unsigned getNestDepth() const {
+ return (Loops.back()->getLoopDepth() - Loops.front()->getLoopDepth() + 1);
+ }
----------------
[suggestion] Add an assertion ensuring that the result would not be negative.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D68789/new/
https://reviews.llvm.org/D68789
More information about the llvm-commits
mailing list