[LLVMdev] Identify recursion in a call graph

Trevor Harmon trevor.w.harmon at nasa.gov
Fri Nov 12 12:19:16 PST 2010


Sorry for the delay in my reply. I was at a conference.

It would of course be desirable to identify this pattern, but I'm not  
sure what effort would be involved in doing so. If it is difficult, I  
think it would be acceptable to define recursion as "recursion that is  
explicitly present in the LLVM CallGraph", not necessarily recursion  
that is present in the code. A documentation note to that effect  
should suffice, though perhaps it could be worded better? What do you  
think?

Trevor

On Nov 5, 2010, at 10:38 PM, Chris Lattner wrote:

> What is the desired behavior for code like this?
>
> extern void bar();
> void foo() {
>  ...
>  bar();
>  ...
> }
>
> In this situation, the call graph will report that foo is not  
> recursive.  However, it *is* possible that bar has an implementation  
> that calls foo.  The call graph originally modeled this possibility  
> explicitly, but it turns that that this makes almost all functions  
> end up in a single big SCC.  Since one of the most important clients  
> of the CallGraph are CallGraphSCC passes, I changed the call graph  
> to stop modeling this behavior, instead using two different abstract  
> nodes.
>
> How do you think should be handled?  At the very least, the comments  
> on isRecursive should mention this case.




More information about the llvm-dev mailing list