[PATCH] D75024: [SCCIterator] Check if a SCC is a natural loop.

Stefanos Baziotis via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Feb 23 12:38:23 PST 2020


baziotis added a comment.

In D75024#1888385 <https://reviews.llvm.org/D75024#1888385>, @Meinersbur wrote:

> In D75024#1888383 <https://reviews.llvm.org/D75024#1888383>, @baziotis wrote:
>
> > Hmm, that's bizarre. Won't the SCCIterator go through all the SCCs? That is, let's say we have a topmost loop with blocks: A, B, C. And blocks B, C also form a loop.
> >  Won't we get a separate SCC for A, B, C and B, C?
>
>
> It uses Tarjan's algorithm <https://en.wikipedia.org/wiki/Tarjan%27s_strongly_connected_components_algorithm> which only returns maximal connected subgraphs. Anything else would be infeasible. Think of a complete graph, every subset of nodes would by strongly connected (but not maximal), hence return an exponential number of strongly connected subgraphs. Only the entire complete graph is maximal and considered a component.


Oh, that's quite bad. Big mistake on my part. I knew it was Tarjan and actually I had implemented but 3-4 years ago. Somehow, I remembered it gets every sub-graph. I just saw the algorithm again and this
makes both this patch wrong and the other.
Thank you very much Michael!


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

https://reviews.llvm.org/D75024





More information about the llvm-commits mailing list