[Bug ipa/124475] Missed devirtualization: single-implementation vtable slot not resolved when pointer loaded from aggregate

thammisettytarun at gmail dot com gcc-bugzilla@gcc.gnu.org
Fri Mar 13 03:43:27 GMT 2026


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124475

--- Comment #2 from tarun thammisetty <thammisettytarun at gmail dot com> ---
Tried trunk (GCC 16.0.1 20260312) — same behavior as GCC 15.                    

With noinline only: call_direct devirtualized via constprop clone,
call_from_member still indirect. With noinline, noclone: both indirect —
confirms devirtualization is entirely via IPA-CP cloning, not vtable slot
analysis.                                                                       

Agreed that const prop + SRA could fix this specific reproducer by decomposing
Holder and propagating the member pointer. But the broader case — pointer from
a runtime container, callback registration, or any path where the concrete type
isn't visible to IPA-CP — would still miss. In those cases the vtable slot has
one implementation program-wide, which is sufficient to devirtualize
unconditionally without needing to track pointer provenance.

Regarding noclone — correct, Clang ignores it. Clang's devirtualization here
comes from WPD resolving vtable slots via type metadata during LTO, not
argument propagation.


More information about the Gcc-bugs mailing list