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

Michael Kruse via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 20 17:50:55 PDT 2020


Meinersbur added inline comments.


================
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(); }
----------------
fhahn wrote:
> 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`.
Could you please add a remark about the following into the comments: LoopInfo does not detect irreducible control flow, just natural loops. That is, it is possible that there is cyclic control flow within the "innermost loop". LoopVectorize for instance explicitly checks for this, see `collectSupportedLoops`. There can also be be cyclic control-flow around the "outermost loop" (I think). IMHO this caveat is important to mention.


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

https://reviews.llvm.org/D82895



More information about the llvm-commits mailing list