public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-1609] Add statistics counting to PHI-OPT
@ 2021-06-18 8:24 Andrew Pinski
0 siblings, 0 replies; only message in thread
From: Andrew Pinski @ 2021-06-18 8:24 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:64b5da8f97122de895af1b13c5f5e103717858c6
commit r12-1609-g64b5da8f97122de895af1b13c5f5e103717858c6
Author: Andrew Pinski <apinski@marvell.com>
Date: Thu Jun 10 02:22:12 2021 -0700
Add statistics counting to PHI-OPT
This should have been done before I started to work on connecting
PHI-OPT to match-and-simplify to see quickly if we miss anything
but it is better late than never.
Anyways there was no statistics counting in PHI-OPT before so adding
it is the right thing to do.
OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions.
gcc/ChangeLog:
* tree-ssa-phiopt.c (replace_phi_edge_with_variable):
Add counting of how many times it is done.
(factor_out_conditional_conversion): Likewise.
(match_simplify_replacement): Likewise.
(value_replacement): Likewise.
(spaceship_replacement): Likewise.
(cond_store_replacement): Likewise.
(cond_if_else_store_replacement_1): Likewise.
(hoist_adjacent_loads): Likewise.
Diff:
---
gcc/tree-ssa-phiopt.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/gcc/tree-ssa-phiopt.c b/gcc/tree-ssa-phiopt.c
index 76f4e7ec843..02e26f974a5 100644
--- a/gcc/tree-ssa-phiopt.c
+++ b/gcc/tree-ssa-phiopt.c
@@ -419,6 +419,8 @@ replace_phi_edge_with_variable (basic_block cond_block,
gsi = gsi_last_bb (cond_block);
gsi_remove (&gsi, true);
+ statistics_counter_event (cfun, "Replace PHI with variable", 1);
+
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file,
"COND_EXPR in block %d and PHI in block %d converted to straightline code.\n",
@@ -618,6 +620,9 @@ factor_out_conditional_conversion (edge e0, edge e1, gphi *phi,
/* Remove the original PHI stmt. */
gsi = gsi_for_stmt (phi);
gsi_remove (&gsi, true);
+
+ statistics_counter_event (cfun, "factored out cast", 1);
+
return newphi;
}
@@ -893,6 +898,11 @@ match_simplify_replacement (basic_block cond_bb, basic_block middle_bb,
replace_phi_edge_with_variable (cond_bb, e1, phi, result);
+ /* Add Statistic here even though replace_phi_edge_with_variable already
+ does it as we want to be able to count when match-simplify happens vs
+ the others. */
+ statistics_counter_event (cfun, "match-simplify PHI replacement", 1);
+
/* Note that we optimized this PHI. */
return true;
}
@@ -1196,6 +1206,8 @@ value_replacement (basic_block cond_bb, basic_block middle_bb,
}
else
{
+ statistics_counter_event (cfun, "Replace PHI with variable/value_replacement", 1);
+
/* Replace the PHI arguments with arg. */
SET_PHI_ARG_DEF (phi, e0->dest_idx, arg);
SET_PHI_ARG_DEF (phi, e1->dest_idx, arg);
@@ -2320,6 +2332,7 @@ spaceship_replacement (basic_block cond_bb, basic_block middle_bb,
gimple_stmt_iterator psi = gsi_for_stmt (phi);
remove_phi_node (&psi, true);
+ statistics_counter_event (cfun, "spaceship replacement", 1);
return true;
}
@@ -2982,6 +2995,7 @@ cond_store_replacement (basic_block middle_bb, basic_block join_bb,
fprintf (dump_file, "\nInserted a new PHI statement in joint block:\n");
print_gimple_stmt (dump_file, new_stmt, 0, TDF_VOPS|TDF_MEMSYMS);
}
+ statistics_counter_event (cfun, "conditional store replacement", 1);
return true;
}
@@ -3056,6 +3070,8 @@ cond_if_else_store_replacement_1 (basic_block then_bb, basic_block else_bb,
else
gsi_insert_before (&gsi, new_stmt, GSI_NEW_STMT);
+ statistics_counter_event (cfun, "if-then-else store replacement", 1);
+
return true;
}
@@ -3469,6 +3485,7 @@ hoist_adjacent_loads (basic_block bb0, basic_block bb1,
gsi_move_to_bb_end (&gsi2, bb0);
gsi2 = gsi_for_stmt (def2);
gsi_move_to_bb_end (&gsi2, bb0);
+ statistics_counter_event (cfun, "hoisted loads", 1);
if (dump_file && (dump_flags & TDF_DETAILS))
{
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-06-18 8:24 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-18 8:24 [gcc r12-1609] Add statistics counting to PHI-OPT Andrew Pinski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).