DSA - LocalDataStructures pass does not create DSGraphs

Hallo.

I wanted to use the DSA from the poolalloc project as a starting point for
static C code analysis (for me it has some benefits to work on LLVM-IR
(generated by clang) instead of C code).

Currently there is no poolalloc version 3.3. Therefore I wrote a quick patch
to make poolalloc 3.2 compile with llvm 3.3 (mostly adaptions to file
relocations were necessary). The patch is attached as it is quite small.

With the foundations working a simple test before getting serious seemed to be
a good idea. So I tried to perform the LocalAnalysis (LocalDataStructures pass
in poolalloc) on the running example (LLVM-IR obtained by clang) of Chris
Lattner's PHD thesis (p. 44) (code attached).

When this pass(LocalDataStructures) is run I can call dumpCallGraph() on it
and get the correct result. But calls to hasDSGraph(const Function &F) all
return false although they should not. DSGraphs should have been built.

Does anyone see what I am doing wrong? Or is this a bug?

Thank you for any help and comments!

Sebald

initialPortTo33.diff (59.8 KB)

lattnersRunningExample.s (4.46 KB)

main.cpp (1.27 KB)

Hallo.

I wanted to use the DSA from the poolalloc project as a starting point for
static C code analysis (for me it has some benefits to work on LLVM-IR
(generated by clang) instead of C code).

Currently there is no poolalloc version 3.3. Therefore I wrote a quick
patch to make poolalloc 3.2 compile with llvm 3.3 (mostly adaptions to
file relocations were necessary). The patch is attached as it is quite
small.

With the foundations working a simple test before getting serious seemed to
be a good idea. So I tried to perform the LocalAnalysis
(LocalDataStructures pass in poolalloc) on the running example (LLVM-IR
obtained by clang) of Chris Lattner's PHD thesis (p. 44) (code attached).

When this pass(LocalDataStructures) is run I can call dumpCallGraph() on it
and get the correct result. But calls to hasDSGraph(const Function &F) all
return false although they should not. DSGraphs should have been built.

Does anyone see what I am doing wrong? Or is this a bug?

Found out what I did wrong:
- PassManager performs cleanup operations (I thought this would only happen if
the PM's dtor gets called)
- stuff gets deleted but parts are still accessible (call graph information)

So this question has actually nothing to do with DSA.

Solution:
Acknowledge the existence of the PassManager environment -> write own pass
that consumes the information of LocalDataStructures pass...