Hi,

On Mon, Sep 21 2026, Josef Melcr wrote:
> Callback edges without a carrying edge weren't permitted, but that
> changed with internal callback edges.  This patch changes the code
> checking that a carrying edge exists to account for this.
>
> gcc/ChangeLog:
>
>       * cgraph.cc (cgraph_node::verify_node): Exclude internal
>       callbacks from carrying edge checks.

the general idea is OK of course but...

>
> Signed-off-by: Josef Melcr <[email protected]>
> ---
>  gcc/cgraph.cc | 15 ++++++++-------
>  1 file changed, 8 insertions(+), 7 deletions(-)
>
> diff --git a/gcc/cgraph.cc b/gcc/cgraph.cc
> index fc1d7838d5d..6dab18cf298 100644
> --- a/gcc/cgraph.cc
> +++ b/gcc/cgraph.cc
> @@ -4437,13 +4437,14 @@ cgraph_node::verify_node (void)
>  
>         if (e->callback)
>           {
> -           if (!e->get_callback_carrying_edge ())
> -             {
> -               error ("callback edge %s->%s has no callback-carrying",
> -                      identifier_to_locale (e->caller->name ()),
> -                      identifier_to_locale (e->callee->name ()));
> -               error_found = true;
> -             }
> +           if (!e->get_callback_carrying_edge ()
> +               && (!e->call_stmt || !gimple_call_internal_p (e->call_stmt)))

but !e->call_stmt is true for all edges in LTO WPA?  (So my related
request is to add some LTO testcase(s) for all this too).

So I think we can either not verify this in this generality in WPA, we
can either skip the test or narrow it down to checking that
cs->callee->assume_function.

Or am I missing something?

Martin

> +           {
> +             error ("callback edge %s->%s has no callback-carrying edge",
> +                    identifier_to_locale (e->caller->dump_name ()),
> +                    identifier_to_locale (e->callee->dump_name ()));
> +             error_found = true;
> +           }
>           }
>  
>         if (e->has_callback
> -- 
> 2.55.0

Reply via email to