From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1314) id EFF07384A02B; Fri, 18 Jun 2021 08:24:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EFF07384A02B MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Andrew Pinski To: gcc-cvs@gcc.gnu.org Subject: [gcc r12-1609] Add statistics counting to PHI-OPT X-Act-Checkin: gcc X-Git-Author: Andrew Pinski X-Git-Refname: refs/heads/master X-Git-Oldrev: 2f1686ff70b25fceb04ca2ffc0a450fb682913ef X-Git-Newrev: 64b5da8f97122de895af1b13c5f5e103717858c6 Message-Id: <20210618082427.EFF07384A02B@sourceware.org> Date: Fri, 18 Jun 2021 08:24:27 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Jun 2021 08:24:28 -0000 https://gcc.gnu.org/g:64b5da8f97122de895af1b13c5f5e103717858c6 commit r12-1609-g64b5da8f97122de895af1b13c5f5e103717858c6 Author: Andrew Pinski 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)) {