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

Stefanos Baziotis via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 30 11:24:45 PDT 2020


baziotis created this revision.
baziotis added reviewers: simoll, jdoerfert, Meinersbur.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
baziotis added a comment.

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)


https://reviews.llvm.org/D82895

Files:
  llvm/include/llvm/Analysis/LoopInfo.h


Index: llvm/include/llvm/Analysis/LoopInfo.h
===================================================================
--- llvm/include/llvm/Analysis/LoopInfo.h
+++ llvm/include/llvm/Analysis/LoopInfo.h
@@ -155,6 +155,7 @@
   iterator end() const { return getSubLoops().end(); }
   reverse_iterator rbegin() const { return getSubLoops().rbegin(); }
   reverse_iterator rend() const { return getSubLoops().rend(); }
+  // Return true if it does not contain any loops.
   bool empty() const { return getSubLoops().empty(); }
 
   /// Get a list of the basic blocks which make up this loop.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D82895.274545.patch
Type: text/x-patch
Size: 582 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200630/d211ad81/attachment.bin>


More information about the llvm-commits mailing list