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

Johannes Doerfert via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 29 15:44:51 PDT 2019


jdoerfert added inline comments.


================
Comment at: docs/LoopTerminology.rst:17
 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.  
 
----------------
> a loop is a set of basic blocks (= nodes in the control flow graph (CFG)) that form a strongly connected component (SCC). In addition, each loop has 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.

(It's not a single cycle.)


================
Comment at: docs/LoopTerminology.rst:31
+  header.
+
 * Given the use of dominance in the definition, all loops are
----------------
A sub-loop is sth. different. A loop can be made up of multiple cycles without having sub-loops.
There is no need for a "largest" cycle. Take

```
h: if (...) goto a; else goto b;
a: if (...) goto h; else goto end;
b: if (...) goto h; else goto end;
```

two cycles: `h -> a -> h` and `h -> b -> h`, neither containing the other one.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D65299





More information about the llvm-commits mailing list