[LLVMdev] EQTDDataStructures omits obvious, direct callee from DSCallGraph

Will Dietz willdtz at gmail.com
Wed Aug 10 21:44:14 PDT 2011


On Tue, Aug 9, 2011 at 10:45 PM, Ben Liblit <liblit at cs.wisc.edu> wrote:
> Andrew Lenharth wrote:
>> If I remember correctly, it only tries to resolve indirect calls.  The
>> analysis doesn't track direct calls because you can do it just as well
>> yourself.
>
> DSCallGraph::callee_begin() and DSCallGraph::callee_end() cooperate to
> iterate over an empty set (EmptyActual) for any call site not found in
> the ActualCallees map.  So if direct calls are not tracked, then I would
> expect the callee iterators for *both* direct calls to yield this empty
> set.  Getting the empty set for one direct call but a correct singleton
> set for the other direct call is a troubling inconsistency that leaves
> me unsure which results I can trust and which I cannot.

Hi Ben,

I just tested the example you gave, and get the same results--one set
is empty, the other contains the expected single function.

As Andrew mentioned, DSA handles indirect and direct callsites
differently, and for direct callsites it's expected that the user
simply looks at the function itself to determine what is called.

In this example, we only track one callsite in test() since as far as
alias analysis goes, the effects of both callsites are same, and we
don't need to consider both callsites to build our analysis. This kind
of optimization is extremely useful in making DSA run on larger codes.

That said, we probably could more cleanly export this information to
the user, but for now just handle direct calls yourself.  Sorry for
the confusion :).

Hope this helps!

~Will




More information about the llvm-dev mailing list