Call an analysis pass inside a tool pass

Hi,

as in the subject, is it possible to call on of the analysis pass present in the LLVM (lib/ folder) within a tool pass (tools/ folder)?

Thanks.
Best,
Simone

Maybe the question is wrong.

I have my own pass (a RegionPass), what I want to do is to add some metadata in the IR and then have this metadata available for another pass (a Function Pass already existing in Transform/Instrumentation, called AddressSanitizer) and use these metadata inside it.

So I was thinking that maybe I have to call first my pass and then the second pass.
However, the second pass is inside the library libLLVMInstrumentation.a and to call it there is a clang option -fsanitize=address.

I tried these command:

clang -fsanitize=address -g -O0 -mllvm -polly -S -emit-llvm -Xclang -load -Xclang $HOME/bigdata/compilers/llvm35/tools/polly/Debug+Asserts/lib/LLVMPolly.so -I$HOME/bigdata/runtime/libomp_oss/exports/common.deb/include -L$HOME/bigdata/runtime/libomp_oss/exports/lin_32e.deb/lib -liomp5 myprogram.c

but the AddressSanitizer pass does not see any new metadata, do you have any idea where could be the problem?

Thanks.
Best,
Simone

Dear Simone,

My guess is that the address sanitizer pass is running before your pass. You should use the -Xclang -debug-pass=Structure argument to see the order in which passes are run.

Regards,

John Criswell