[PATCH] D65299: Try to clarify loop definition around confusing sub-loop case

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 30 11:45:01 PDT 2019


reames updated this revision to Diff 212398.
reames added a comment.

I think I've reformulated this to incorporate the review comments, let me know what you think.


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

https://reviews.llvm.org/D65299

Files:
  docs/LoopTerminology.rst


Index: docs/LoopTerminology.rst
===================================================================
--- docs/LoopTerminology.rst
+++ docs/LoopTerminology.rst
@@ -12,18 +12,25 @@
 of the common terminology used within LLVM code to describe loop
 structures.
 
-First, let's start with the basics.  In LLVM, a Loop is a cycle within
-the control flow graph (CFG) where there exists one block (the loop
-header block) which dominates all other blocks within the cycle.
+First, let's start with the basics.  In LLVM, a Loop is a set of basic
+blocks that form a strongly connected component (SCC) in the Control
+Flow Graph (CFG) where there exists a dedicated entry/header block that
+dominates all other blocks within the loop. Thus, without leaving the
+loop, one can reach every block in the loop from the header block and
+the header block from every block in the loop.
 
 Note that there are some important implications of this definition:
 
-* Not all cycles are loops.  There exist cycles that do not meet the
+* Not all SCCs are loops.  There exist SCCs that do not meet the
   dominance requirement and such are not considered loops.  
 
-* Loops can contain non-loop cycles and non-loop cycles may contain
+* 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 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.  
 
@@ -52,7 +59,7 @@
 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
 loop.  (The latter is required for the block to be contained within the
-cycle which makes up the loop.)  That is, it has a successor which is
+SCC which makes up the loop.)  That is, it has a successor which is
 an Exit Block.  
 
 Exit Block - A basic block outside of the associated loop which has a


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D65299.212398.patch
Type: text/x-patch
Size: 2109 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190730/7c3365b9/attachment.bin>


More information about the llvm-commits mailing list