[PATCH] D88183: [LoopInfo] Clarify header-loop relationship

Stefanos Baziotis via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 23 14:22:20 PDT 2020


baziotis created this revision.
baziotis added reviewers: Meinersbur, fhahn, jdoerfert, simoll.
Herald added subscribers: llvm-commits, yaxunl.
Herald added a project: LLVM.
baziotis requested review of this revision.

I'm not sure if I have phrased it correctly or if I have understood completely analyze() <https://llvm.org/doxygen/classllvm_1_1LoopInfoBase.html#a280d02be3ec3eb6527c1ea944d902775> but it seems to me that: Two loops can't have the same header (even if one is a sub-loop of another, which btw is not clear what it means in this context).

Example: https://godbolt.org/z/bqo8KP


https://reviews.llvm.org/D88183

Files:
  llvm/docs/LoopTerminology.rst


Index: llvm/docs/LoopTerminology.rst
===================================================================
--- llvm/docs/LoopTerminology.rst
+++ llvm/docs/LoopTerminology.rst
@@ -29,9 +29,9 @@
 * Loops can contain non-loop SCCs and non-loop SCCs may contain
   loops.  Loops may also contain sub-loops.
 
-* A header block is uniquely associated with one loop.  There can be
-  multiple SCC within that loop, but the strongly connected component
-  (SCC) formed from their union must always be unique.
+* A header block is uniquely associated with one loop (and vice versa).
+  There can be multiple SCC within that loop, but the strongly connected
+  component (SCC) formed from their union must always be unique.
 
 * Given the use of dominance in the definition, all loops are
   statically reachable from the entry of the function.  
@@ -58,8 +58,10 @@
 **Header Block** - The basic block which dominates all other blocks
 contained within the loop.  As such, it is the first one executed if
 the loop executes at all.  Note that a block can be the header of
-two separate loops at the same time, but only if one is a sub-loop
-of the other.
+two natural loops at the same time.  However, in such cases, LoopInfo
+considers them as part of one "big" loop (in order to enforce the
+guarantee that a header block is associated with exactly one loop
+and any loop has exactly one header).
 
 **Exiting Block** - A basic block contained within a given loop which has
 at least one successor outside of the loop and one successor inside the


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D88183.293860.patch
Type: text/x-patch
Size: 1538 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200923/0a7bf2eb/attachment.bin>


More information about the llvm-commits mailing list