[llvm] [ThinLTO] Optionally import noinline callees at critical call sites (PR #229540)

Teresa Johnson via llvm-commits llvm-commits at lists.llvm.org
Sat Oct 10 07:42:07 PDT 2026


teresajohnson wrote:

> Open questions where I'd welcome guidance:
> 
> * **Default on?** I made the option opt-in to keep sample PGO unchanged. Would it be fine to make this the default, since a critical edge means the module asked for that import?

Yes, that seems fine. For SamplePGO uses there really shouldn't be any such edges to noinline functions given that it must have been inlined to get the critical edge.

> * **A dedicated signal.** Reusing the sample PGO import GUIDs works but overloads their meaning. Is a separate summary flag for "import requested" preferred?

I'd prefer to keep the implementation simple and just reuse the existing mechanism. Perhaps a comment could be added to where the critical edges are defined/discussed in the SamplePGO context to note that this may be used for other purposes by other front ends.

> * **Imports at `-O0`.** `LTO::runThinLTO` skips `ComputeCrossModuleImport` entirely when `OptLevel == 0`, so an `-O0` link imports nothing, even on requested edges. Computing only the critical-edge imports at O0 would make `-O0` links work for such users too. I can follow up with that if it sounds reasonable.

Yes, this normally doesn't make sense for O0. But to see why we bothered to disabled at -O0, I looked back at the change that introduced this, which turned out to be a workaround for an actual failure: https://reviews.llvm.org/D25918. The bug it references is https://bugs.llvm.org/show_bug.cgi?id=30774. And while the original failure situation was addressed by a change to debug metadata, the last comment in that bug does point to what I can still see is a potential reference from debug metadata that if imported and not cleaned up could cause a similar issue. I don't know if other changes have since addressed the root cause there, however.

I assume you need this latter issue addressed to get importing to work for you, or are you invoking ComputeCrossModuleImport yourself from Enzyme?

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


More information about the llvm-commits mailing list