[LLVMdev] Registering a custom opt pass as a default one

Alexander Potapenko ramosian.glider at gmail.com
Tue Apr 19 02:53:39 PDT 2011

Hi Devang,

> You can modify llvm/Support/StandardPasses.h to include your pass by default one appropriate optimization level is used. However, llvm-gcc or clang works on one source file at a time, so it won't do your step 2) automatically for you.
My wrapper is working on one source file at a time as well, so it's
not a problem IIUYC.
Do you mean that adding a pass to llvm/Support/StandardPasses.h makes
llvm-gcc automatically handle it without recompilation of the

> What you want is link time optimization. See
>        http://llvm.org/docs/LinkTimeOptimization.html
> and
>        http://llvm.org/docs/GoldPlugin.html
> If you add your pass in gold plugin by modifying createStandardLTOPasses() then I believe it will do what you intend to do.
What we're doing is somewhat orthogonal to link time optimization.
Indeed running the instrumentation on the single module after
everything has been linked is a promising idea (although I suspect
that large projects, e.g. Chromium, may have problems with LLVM LTO at
this time -- it just hadn't been tested by anyone yet). But running
per-file instrumentation has its advantages as well: for example, we
can easily recompile a piece of the project with instrumentation


More information about the llvm-dev mailing list