[LLVMdev] Callgraph inaccuracy

Maxim Olifer olifer.maxim at gmail.com
Sun May 24 02:31:39 PDT 2015


Hello,

I am trying to extract a callgraph using DSA, but the analysis looks quite
pessimistic. I use TDD analysis and here is my test code:

#include <stdlib.h>

typedef void (*tX)(int a, int b);
typedef void (*tY)(int a);

typedef struct {
	tX p ;
	int n;
} msg;

static void A1(int a) { }
static void B2(int a, int b) { }
static void C2(int a, int b) { }


tY q;

static void decode(tX decoder_f){
    decoder_f(1,2);
}

int main(void) {
    msg *a = malloc(sizeof(msg));
    q = &A1;
    a->p = &B2;
    decode(&C2);

    return 0;
}

The result that I get is:

main: [malloc decode ]
A1: []
B2: []
C2: []
decode: [A1 B2 C2 ]

Why does "decode" function have two extra callees (A1 and B2)? Is it
possible to filter them out?

Kind Regards, Maxim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150524/d25b31f3/attachment.html>


More information about the llvm-dev mailing list