[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
Thu Jul 25 14:16:51 PDT 2019


reames created this revision.
reames added reviewers: jdoerfert, fhahn.
Herald added subscribers: bollu, mcrosier.
Herald added a project: LLVM.

As pointed out by reviewers, my own mental model here was wrong.  So, let's try revising the definition to make that more clear.


Repository:
  rL LLVM

https://reviews.llvm.org/D65299

Files:
  docs/LoopTerminology.rst


Index: docs/LoopTerminology.rst
===================================================================
--- docs/LoopTerminology.rst
+++ docs/LoopTerminology.rst
@@ -14,7 +14,7 @@
 
 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.
+header block) which dominates all other blocks within that cycle.  
 
 Note that there are some important implications of this definition:
 
@@ -24,6 +24,11 @@
 * Loops can contain non-loop cycles and non-loop cycles may contain
   loops.  Loops may also contain sub-loops.
 
+* A header block is uniquely associated with one loop.  There can be
+  multiple cycles within that loop (e.g. sub-loops), but the *largest*
+  cycle must always be the union of all the cycles which contain the
+  header.
+
 * Given the use of dominance in the definition, all loops are
   statically reachable from the entry of the function.  
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D65299.211817.patch
Type: text/x-patch
Size: 1010 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190725/d42388aa/attachment.bin>


More information about the llvm-commits mailing list