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

Stefanos Baziotis via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 2 17:18:00 PDT 2020


baziotis updated this revision to Diff 275259.
baziotis added a comment.

Added `isInnermost/Outermost`.


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

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,7 +155,11 @@
   iterator end() const { return getSubLoops().end(); }
   reverse_iterator rbegin() const { return getSubLoops().rbegin(); }
   reverse_iterator rend() const { return getSubLoops().rend(); }
+  /// Return true if the loop does not contain any sub-loops.
   bool empty() const { return getSubLoops().empty(); }
+  bool isInnermost() const { return empty(); }
+  // Outermost is the same as top-level.
+  bool isOutermost() const { return getParentLoop() == nullptr; }
 
   /// Get a list of the basic blocks which make up this loop.
   ArrayRef<BlockT *> getBlocks() const {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D82895.275259.patch
Type: text/x-patch
Size: 793 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200703/1f5d7705/attachment.bin>


More information about the llvm-commits mailing list