[PATCH] D36311: [ThinLTO] Add GraphTraits for FunctionSummaries

Davide Italiano via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 16 00:51:41 PDT 2017


davide added a comment.

In https://reviews.llvm.org/D36311#842488, @ncharlie wrote:

> I don't think I can use a topological sort in this case since the FunctionSummary callgraph isn't necessarily a DAG, so if there's a cycle it would make the sort useless.


No callgraph is guaranteed to be a DAG, what's a DAG is the condensed graph, where you contract every node of a component to a single vertex.
The data-flow algorithms generally work first propagating within a single SCC (using a worklist algorithm) until you hit a maximal fixpoint, then propagating topologically the facts you learned across the graphs of SCCs.

> Instead, I tried using the main function as the entry node and that worked. Any suggestions on a clean way of implementing this rather than hard coding a lookup for "main" in the Index?

I'm not sure you're always guaranteed to have the `main` function as entry point of your program.


https://reviews.llvm.org/D36311





More information about the llvm-commits mailing list