[PATCH] D112696: CycleInfo: Introduce cycles as a generalization of loops
Sameer Sahasrabuddhe via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 5 23:18:27 PDT 2021
sameerds added inline comments.
================
Comment at: llvm/docs/CycleTerminology.rst:29
+ --- Thus, the header of the cycle is implementation-defined.)
+4. The *root cycle* consists of all basic blocks of a function. Its
+ header is the entry block of the function.
----------------
ruiling wrote:
> Why do we need this `root cycle`? All the blocks of a function mostly do not even form a strongly connected region. And this is quite different from the way LoopInfo works.
> Why do we need this `root cycle`? All the blocks of a function mostly do not even form a strongly connected region. And this is quite different from the way LoopInfo works.
I should copy a comment from GenericCycleInfo class to this spec. Essentially, the "root" is a placeholder cycle that allows CycleInfo to be treated as a single tree. Then we can use GraphTraits as follows (see `validateTree()` in GenericCycleImpl.h):
```
for (const CycleT *cycle : depth_first(getRoot())) { ... }
```
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D112696/new/
https://reviews.llvm.org/D112696
More information about the llvm-commits
mailing list