[PATCH] D82895: [NFC][LoopInfo] Document empty()
Stefanos Baziotis via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 30 11:58:50 PDT 2020
baziotis added a comment.
In D82895#2123566 <https://reviews.llvm.org/D82895#2123566>, @fhahn wrote:
> In D82895#2123465 <https://reviews.llvm.org/D82895#2123465>, @baziotis wrote:
>
> > I created the review instead of just committing to discuss that it may be a good idea to even rename this e.g. to "isInnermost()".
> > With "empty()", it's not clear if the implementation is:
> > `return getSubLoops().empty()` or `return !getNumBlocks()` (or something else)
>
>
> I think using `empty` makes sense in the context of `begin()` and `end()`
Indeed.
> also iterating over subloops.
I think that `isInnermost()` would make even more sense. That is, one iterates until they reach the innermost loop.
Personally, in uses like this: https://github.com/llvm/llvm-project/blob/master/llvm/lib/Analysis/LoopAccessAnalysis.cpp#L1768
it doesn't make much sense (although here it does because of the comment and error msg).
One alternative would be to make an `isInnermost()` wrapper.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D82895/new/
https://reviews.llvm.org/D82895
More information about the llvm-commits
mailing list