<div dir="ltr"><br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I am trying to apply DSA (from the poolalloc project - I'm on LLVM 3.2)<br>
on the following C program and found that the generated callgraph<br>
over-approximates the callees for the simple indirect call.<br>
<br>
#include <stdio.h><br>
__attribute__((noinline)) static int f1(int arg1, int arg2) {<br>
     return arg1 + arg2;<br>
}<br>
__attribute__((noinline)) static int run_func(int (*fptr)(int, int), int<br>
arg1, int arg2) {<br>
     return (*fptr)(arg1, arg2);<br>
}<br>
__attribute__((noinline)) static int foo() {<br>
     return run_func(&f1, 1, 2);<br>
}<br>
int main(int argc, char *argv[]) {<br>
     printf("Main: %p\n", &main);<br>
     printf("Sum:  %d\n", foo());<br>
}<br>
<br>
Using the TDDataStructures, I would expect that the callgraph of above<br>
program shows that run_func can only call f1. However, it seems that DSA<br>
is falling back to an address-taken approach and tells us it can also<br>
call main.<br>
</blockquote>
<br></span>
Looking at your code, you're using EQTDDataStructures (EQTD).  Try using TDDataStructures (TD) instead and see if you get a more accurate result.  You only need EQTD if you need every target of an indirect call to have the same DSGraph, and you don't need that if all you need is a call graph.<br>
<br>
Also, I recently discovered that someone had updated the DSA code to build with LLVM mainline.  I took a snapshot of that and put it up at <a href="https://github.com/jtcriswell/llvm-dsa" target="_blank">https://github.com/jtcriswell/llvm-dsa</a>.<br></blockquote></div><br></div><div class="gmail_extra">It seems I accidentally attached the wrong source file: the results when using TDDataStructures were actually the same. I then started trying different datastructures, all of no luck. Does this mean that the current DSA implementation cannot handle above case? Do you know why?<br><br></div><div class="gmail_extra">With kind regards,<br><br></div><div class="gmail_extra">Victor van der Veen<br></div><div class="gmail_extra"><br></div></div>