[PATCH] D82895: [LoopInfo] empty() -> isInnermost(), add isOutermost()

Stefanos Baziotis via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 22 11:23:56 PDT 2020


baziotis 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(); }
----------------
Meinersbur wrote:
> 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.
If we wanted to appear on both function's doc, I think I'd have to add it twice. So I added it above both and I mention `(natural)` in each function.


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

https://reviews.llvm.org/D82895



More information about the llvm-commits mailing list