GSoC: possible IPA-ICF project direction
Rohith Kapelli
kapellirohith@gmail.com
Mon Sep 14 19:22:00 GMT 2026
Hi Richard,
I looked into the separate-body idea using reduced testcases for PR119006 and PR123227, using trunk from 3 September, before the PR119006 and PR123227 fixes.
For PR119006, the current merge is safe when the leader's out-of-line body is not inlined, but inlining the leader into the other caller produces the wrong code. Defining the two structs in the opposite order swaps the leader and makes the failure disappear. I also emulated your model by making both functions always_inline, putting them in an anonymous namespace so the originals get inlined into their own callers while ICF still merges the out-of-line copies. That exits 0.
PR123227 looks different: the leader's out-of-line body itself depends on a nonnull this promise that only the leader makes. The emitted leader has no null check, while the inlined copy retains it, so out-of-line callers still reach the problematic body. I haven't implemented the separate-body scheme, so this is only what the testcase shows.
I also checked the GNU extern inline point. With both definitions in one file, the gnu_inline body is dropped and even the direct call uses the out-of-line definition; with separate files, the direct call inlines the gnu_inline body while the pointer call uses the out-of-line one.
I don't have a clean test of the IPA-clone part yet. I'll look next at how ICF currently handles the losing bodies, and whether the separate-body idea from the extern inline discussion could apply.
Thanks,
Rohith
More information about the Gcc
mailing list