[llvm] [ADT] SCC iterator for general graph (PR #84268)

Yida Zhang via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 8 20:55:15 PST 2024


zyd2001 wrote:

I don't have plan to upstream code for now. I'm not sure whether currently llvm project need this, but I do see in `LazyCallGraph` there is a generic implementation of Tarjan's DFS called `buildGenericSCCs`. Maybe this iterator can be used there.
Also, I believe this implementation can replace the old one since it is just more generic implementation and should produce the same result as the old `scc_iterator`.
However, I think the problem is that the current documentation and interface of SCC Iterator is misleading. It says "Enumerate the SCCs of a directed graph in reverse topological order of the SCC DAG" and the interface just accepts a graph. But it only processes the graph from a single entry node. My colleague and I used it to compute SCC on generic graphs without knowing it is not the correct we to use. We found this problem only after we got weird output and dig into the code.

https://github.com/llvm/llvm-project/pull/84268


More information about the llvm-commits mailing list