]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
cfg: Fix count when creating new forwarder block
authorAndrew Pinski <andrew.pinski@oss.qualcomm.com>
Tue, 9 Dec 2025 06:53:06 +0000 (22:53 -0800)
committerAndrew Pinski <andrew.pinski@oss.qualcomm.com>
Fri, 12 Dec 2025 20:18:38 +0000 (12:18 -0800)
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.

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 <andrew.pinski@oss.qualcomm.com>
gcc/tree-cfg.cc

index f0a5e0538b1ddde0e1b174f7e7d69a158c96d7c2..8ee208b3032a2bfa831a02479416535529ea92d5 100644 (file)
@@ -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)
                    {