[llvm] [LTO] Enable adding custom pass instrumentation callbacks (PR #71268)

Igor Kudrin via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 22 13:45:30 PST 2023


igorkudrin wrote:

> Can you add a test, which looks like it will also require adding an LLVM mechanism for setting this hook.

Added a unittest that uses the hook.

> the commit message is confusing, this isn't customizing the optimization pipeline, it's customizing `PassInstrumentationCallbacks`

Updated. Is it better now?

> I don't think we have this sort of functionality elsewhere for the default optimization pipelines, why do you specifically just want this for the LTO pipeline?

We are working on a downstream tool that pre-links bitcode files, runs optimization passes, and produces bitcode file output that can be used later for a final link with LTO, so we run LTO for input files but interrupt the process before codegen. Some passes in the default optimization pipeline, like `EliminateAvailableExternallyPass`, might be detrimental to this scheme and should be excluded. I suppose the easiest way to accomplish this is to provide a hook that enables adding corresponding filters. I do not think a more complex and general mechanism for customizing the pipeline is needed yet.

https://github.com/llvm/llvm-project/pull/71268


More information about the llvm-commits mailing list