On Tue, Dec 9, 2025 at 12:55 PM Andrew Pinski
<[email protected]> wrote:
>
> This was a bug previously but maybe did't matter as most of
> the time the block was going to be removed after cddce.
> Anyways the problem here is the count of the new bb was missing
> of the first edge that was moved to it. So the fix is reuse the count
> after the splitting of the edge as the initial value instead of 0.
>
> This does not fix gcc.target/i386/pr90178.c with -m32, but at least
> we don't get any more warning saying the incorrect count happening.

This looks to bring back performance for nab_r for aarch64 at -Ofast.

Thanks,
Andrew Pinski

>
> Bootstrapped and tested on x86_64-linux-gnu.
>
> gcc/ChangeLog:
>
>         PR tree-optimization/103680
>         * tree-cfg.cc (make_forwarders_with_degenerate_phis): Fix
>         initial value of the count to new bb.
>
> Signed-off-by: Andrew Pinski <[email protected]>
> ---
>  gcc/tree-cfg.cc | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/gcc/tree-cfg.cc b/gcc/tree-cfg.cc
> index f0a5e0538b1..8ee208b3032 100644
> --- a/gcc/tree-cfg.cc
> +++ b/gcc/tree-cfg.cc
> @@ -10352,7 +10352,7 @@ make_forwarders_with_degenerate_phis (function *fn)
>                                args[start].first->dest->index);
>                     }
>                   basic_block forwarder = split_edge (args[start].first);
> -                 profile_count count = profile_count::zero ();
> +                 profile_count count = forwarder->count;
>                   bool irr = false;
>                   for (unsigned j = start + 1; j < i; ++j)
>                     {
> --
> 2.43.0
>

Reply via email to