Externally loadable Alias Analysis pass


I am currently working with the implementation of CFL Andersen algorithmand I am trying to do some improvements to the Andersen algorithm.

I would like to create loadable module .so and run clang with my e.g. “cfl-anders-improved.so” to avoid the “long” way - generating IR, running opt with my improved algorithm to generate optimalized code and then building it.

Is a such thing even possible for Alias analyses in Clang?


Hi, David,

We do have an infrastructure for incorporating custom AA providers into the pipeline. I’ve never tried it, but take a look at unittests/Analysis/AliasAnalysisTest.cpp (that may provide some of what you need).


I am currectly experimenting with -Xclang option… I have a simple pass (to just print function names).

I ran: clang -Xclang -load -Xclang LLVMHello.so t.c

but nothing was printed, no output from the pass.

when I run: opt -load LLVMHello.so -hello t.ll

I get the output from pass (i.e. list of function names)

Part of the source ode of the Hello pass:

struct Hello : public FunctionPass {
static char ID; // Pass identification, replacement for typeid
Hello() : FunctionPass(ID) {}

bool runOnFunction(Function &F) override {
errs().write_escaped(F.getName()) << ‘\n’;
return false;