[gcc r16-5358] mergephi: Add stats
Andrew Pinski
pinskia@gcc.gnu.org
Mon Nov 17 19:07:24 GMT 2025
https://gcc.gnu.org/g:fd498ee0909d494f19fbb5803942ca423f2cc763
commit r16-5358-gfd498ee0909d494f19fbb5803942ca423f2cc763
Author: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
Date: Sat Nov 15 14:44:21 2025 -0800
mergephi: Add stats
This just adds a simple stats recording. Main reason is that I want to find
out if we can remove one of the mergephi now.
Bootstrapped and tested on x86_64-linux-gnu.
gcc/ChangeLog:
* tree-cfgcleanup.cc (pass_merge_phi::execute): Add stats for the removed
blocks.
Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
Diff:
---
gcc/tree-cfgcleanup.cc | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/gcc/tree-cfgcleanup.cc b/gcc/tree-cfgcleanup.cc
index a78b711d82c3..9aeb4f3fc99e 100644
--- a/gcc/tree-cfgcleanup.cc
+++ b/gcc/tree-cfgcleanup.cc
@@ -1372,10 +1372,10 @@ public:
unsigned int
pass_merge_phi::execute (function *fun)
{
+ int forwarder_removed = 0;
calculate_dominance_info (CDI_DOMINATORS);
/* Find all PHI nodes that we may be able to merge. */
- bool changed = false;
unsigned n = last_basic_block_for_fn (fun);
for (unsigned i = NUM_FIXED_BLOCKS; i < n; i++)
{
@@ -1386,15 +1386,17 @@ pass_merge_phi::execute (function *fun)
/* Look for a forwarder block with PHI nodes. */
if (tree_forwarder_block_p (bb)
&& remove_forwarder_block (bb, true))
- changed = true;
+ forwarder_removed++;
}
/* Removing forwarder blocks can cause formerly irreducible loops
to become reducible if we merged two entry blocks. */
- if (changed
+ if (forwarder_removed != 0
&& current_loops)
loops_state_set (LOOPS_NEED_FIXUP);
+ statistics_counter_event (fun, "Forwarder blocks removed",
+ forwarder_removed);
return 0;
}
More information about the Gcc-cvs
mailing list