https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124475
--- Comment #5 from tarun thammisetty <thammisettytarun at gmail dot com> --- Dug into ipa-devirt.cc to understand why the guard isn't dropped. Two findings: 1. ipa_devirt() only ever calls e->make_speculative() — it never does unconditional devirt, even when possible_polymorphic_call_targets() returns complete=true with a single target. 2. The existing unconditional devirt paths (gimple_fold_call(), ipa_prop.cc) do check if (final && targets.length() <= 1) and call make_direct(), but they rely on frontend type info or IPA-CP context propagation — neither of which can trace the concrete type through a container. So the gap is: ipa_devirt() has the type hierarchy information to prove a single target, but only uses it for speculation. The unconditional paths have the mechanism, but lack the information. Would the right fix be to have ipa_devirt() call ipa_make_edge_direct_to_target() with speculative=false when the target list is complete with one entry? Or is there a reason the pass was kept purely speculative?
