Prabhuk wrote:

> > > so, you emit a label at every call site, right? and then you write out 
> > > the address of the label w/ each callee symbol?
> > > So if I have a hundred calls to foo in my function, I get 100 entries? Am 
> > > I understanding that right?
> > 
> > 
> > Yes. That is correct.
> 
> That seems very unfortunate. I'm not sure we should really be doing that. A 
> call graph doesn't exactly care about where a call is coming from, and AFAIK 
> there are no plans to ever make use of that kind of information. What you 
> record in the section should be the set of things that are called, and there 
> should be no duplicates. As it is, I expect this section to be large, so I'd 
> prefer we don't bloat it in the first place. Especially since IO is rather 
> costly.

The change to record the unique callees only and not recording the callsite 
addresses sounds sensible to be. This brings up another question which I hadn't 
thought of originally. If all the direct calls to a given function is removed 
from a function, we do not currently have a way of pruning it out from our 
callgraph info. We can address this partially by first swapping how we store 
direct call info. Instead of storing all callees of a given function in 
per-function callgraph info, we can store all callers of a given function. If a 
function is completely GC'd it will help us drop those edges in a 
straightforward way. But the question still remains regarding how to prune a 
direct callee when all direct calls to it from a given function is removed but 
the callee is not garbage collected entirely. 

https://github.com/llvm/llvm-project/pull/155706
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to