From: Andrew Pinski Date: Tue, 9 Dec 2025 06:53:06 +0000 (-0800) Subject: cfg: Fix count when creating new forwarder block X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9f27ac9b83af5e01098481d4a776fabb53f63618;p=thirdparty%2Fgcc.git 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 --- 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) {