[LLVMdev] Identify recursion in a call graph

Chris Lattner clattner at apple.com
Fri Nov 5 22:38:59 PDT 2010


On Nov 5, 2010, at 3:21 PM, Trevor Harmon wrote:

> On Nov 2, 2010, at 11:08 PM, Nick Lewycky wrote:
> 
>> The unittests/ directory contains C++ unit tests for arbitrary C++ APIs
>> that don't fit the dejagnu model of running opt or llc over .ll files.
> 
> Thanks for the tip. Attached is a patch+testcase that adds CallGraphNode::isRecursive to LLVM. Could someone with commit access please review and apply? Thanks,

Hi Trevor,

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.

-Chris





More information about the llvm-dev mailing list