Hi,

On Sat, Oct 18 2025, Josef Melcr wrote:
> When a callback-carrying edge is redirected to __builtin_unreachable,
> the associated callbacks will never get called, so the corresponding
> callback edges must be deleted, as they no longer reflect the reality.
>
> The line in analyze_function_body is an obvious typo I discovered during
> debugging, so I decided to bundle it in.
>
> gcc/ChangeLog:
>
>       * ipa-fnsummary.cc (redirect_to_unreachable): Purge callback
>       edges when redirecting the carrying edge.
>       (analyze_function_body): Fix typo.

This is OK, thanks.

Martin


>
> Signed-off-by: Josef Melcr <[email protected]>
> ---
>  gcc/ipa-fnsummary.cc | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/gcc/ipa-fnsummary.cc b/gcc/ipa-fnsummary.cc
> index e7b81d83fe1..bf98a449584 100644
> --- a/gcc/ipa-fnsummary.cc
> +++ b/gcc/ipa-fnsummary.cc
> @@ -271,6 +271,8 @@ redirect_to_unreachable (struct cgraph_edge *e)
>    es->call_stmt_time = 0;
>    if (callee)
>      callee->remove_symbol_and_inline_clones ();
> +  if (e->has_callback)
> +    e->purge_callback_edges ();
>    return e;
>  }
>  
> @@ -3119,8 +3121,7 @@ analyze_function_body (struct cgraph_node *node, bool 
> early)
>                 for (cbe = edge->first_callback_edge (); cbe;
>                      cbe = cbe->next_callback_edge ())
>                   {
> -                   ipa_call_summary *es2 = ipa_call_summaries->get (cbe);
> -                   es2 = ipa_call_summaries->get_create (cbe);
> +                   ipa_call_summary *es2 = ipa_call_summaries->get_create 
> (cbe);
>                     ipa_call_summaries->duplicate (edge, cbe, es, es2);
>                     /* Unlike speculative edges, callback edges have no real
>                        size or time; the call doesn't exist.  Reflect that in
> -- 
> 2.51.1.dirty

Reply via email to