[PATCH] D82895: [NFC][LoopInfo] Document empty()

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 30 11:56:47 PDT 2020


fhahn added a comment.

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()` also iterating over subloops.



================
Comment at: llvm/include/llvm/Analysis/LoopInfo.h:158
   reverse_iterator rend() const { return getSubLoops().rend(); }
+  // Return true if it does not contain any loops.
   bool empty() const { return getSubLoops().empty(); }
----------------
make a doc-comment (`///`)? It might be good to mention sub-loops in the comment, e.g something like `Return true if the loop contains any sub-loops`.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D82895/new/

https://reviews.llvm.org/D82895





More information about the llvm-commits mailing list