[clang] [KeyInstr] Enable -gkey-instructions by default if optimisations are enabled (PR #149509)

Orlando Cazalet-Hyams via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 10 09:24:48 PDT 2025


OCHyams wrote:

@rnk despite my claims in the comment above, with @omern1's help, I've been able to observe something like you've described with SPGO without LTO.

Our initial experiments suggest that `-gkey-instructions` doesn't have an effect when used on the profile-gathering build. But the` -fprofile-sample-use` build is affected. I'm not yet sure why this is the case.

Key Instructions adds extra fields to `DILocation`s, so my first instinct is that this breaks some assumption somewhere in the PGO pipeline. E.g., `DILocation` pointer equality no longer working as expected, or some code otherwise getting confused about these new fields. I'm not terribly familiar with PGO in LLVM so it's slow going. I'm continuing to look into this, but thought it would be worth letting you know in case anyone has any insights.

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


More information about the cfe-commits mailing list