https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96394
--- Comment #15 from Martin Jambor <jamborm at gcc dot gnu.org> --- so after Martin asked some good questions, it turns out this should probably be avoided in ipa-prop, after all, as with, for example (untested): diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c index b28c78eeab4..58ffedc20b1 100644 --- a/gcc/ipa-prop.c +++ b/gcc/ipa-prop.c @@ -3787,11 +3787,12 @@ update_indirect_edges_after_inlining (struct cgraph_edge *cs, param_index = ici->param_index; jfunc = ipa_get_ith_jump_func (top, param_index); - cgraph_node *spec_target = NULL; - /* FIXME: This may need updating for multiple calls. */ - if (ie->speculative) - spec_target = ie->first_speculative_call_target ()->callee; + auto_vec<cgraph_node *, 4> spec_targets; + for (cgraph_edge *direct = ie->first_speculative_call_target (); + direct; + direct = direct->next_speculative_call_target ()) + spec_targets.safe_push (direct->callee); if (!opt_for_fn (node->decl, flag_indirect_inlining)) new_direct_edge = NULL; @@ -3814,7 +3815,7 @@ update_indirect_edges_after_inlining (struct cgraph_edge *cs, /* If speculation was removed, then we need to do nothing. */ if (new_direct_edge && new_direct_edge != ie - && new_direct_edge->callee == spec_target) + && spec_targets.contains (new_direct_edge->callee)) { new_direct_edge->indirect_inlining_edge = 1; top = IPA_EDGE_REF (cs);