[gcc r16-6069] cfg: Fix count when creating new forwarder block
Andrew Pinski
pinskia@gcc.gnu.org
Fri Dec 12 20:19:10 GMT 2025
https://gcc.gnu.org/g:9f27ac9b83af5e01098481d4a776fabb53f63618
commit r16-6069-g9f27ac9b83af5e01098481d4a776fabb53f63618
Author: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
Date: Mon Dec 8 22:53:06 2025 -0800
cfg: Fix count when creating new forwarder block
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>
Diff:
---
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 f0a5e0538b1d..8ee208b3032a 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)
{
More information about the Gcc-cvs
mailing list