<div dir="ltr">I just realized that I've been misunderstanding this (I think). If I'm understanding it now, the entry node for the graph should actually be the graph's root (not a bottom node), and that the scc_iterator works its way down. So for the ModuleSummary, I should find the main function and return that (or whatever function is the entry point for the entire program).<div><br></div><div>If anyone has suggestions for the patch, I'd still be interested in hearing them.</div><div><br>- Charles</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Aug 9, 2017 at 10:21 AM, Charles Saternos <span dir="ltr"><<a href="mailto:charles.saternos@gmail.com" target="_blank">charles.saternos@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hey all,<div><br>I'm working on adding function attribute propagation to function summaries in the ThinLTO index, and have run into some trouble with ensuring bottom-up traversal when finding the SCCs in the call graph.</div><div><br></div><div>I'm basing my implementation for the GraphTraits for the ModuleSummaryIndex off the GraphTraits<CallGraph *> implementation (<a href="http://llvm-cs.pcc.me.uk/include/llvm/Analysis/CallGraph.h#407" target="_blank">http://llvm-cs.pcc.me.uk/<wbr>include/llvm/Analysis/<wbr>CallGraph.h#407</a>). In the GraphTrait<CallGraph *> definition, the getEntryNode function returns the external calling node (<a href="http://llvm-cs.pcc.me.uk/include/llvm/Analysis/CallGraph.h#450" target="_blank">http://llvm-cs.pcc.me.uk/<wbr>include/llvm/Analysis/<wbr>CallGraph.h#450</a>), which I assume is supposed to be at the bottom of the callgraph. Would doing same for the ModuleSummaryIndex ensure the scc_iterator traverses bottom up (if that even makes sense)?</div><div><br></div><div>Rather than returning a dummy FunctionSummary that's empty for external functions (which is what I'm doing right now), would it make more sense to have one node that represents all external FunctionSummaries? If I used this FunctionSummary as the entry point for the scc_iterator traversal of the ModuleSummaryIndex callgraph would the traversal be bottom up? <br><br>Here's my patch in its current state: <a href="https://reviews.llvm.org/D36311" target="_blank">https://reviews.llvm.<wbr>org/D36311</a></div><div><br></div><div>Thanks,</div><div>Charles</div></div>
</blockquote></div><br></div>