diff options
author | Richard Biener <rguenther@suse.de> | 2018-08-27 10:55:53 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2018-08-27 10:55:53 +0000 |
commit | 78ea9abc2018243af7f7ada6135144ac90c6ad27 (patch) | |
tree | 54378267ac437a8e59e1ddd669550b60dd8f788f /gcc/tree-ssa-loop-ivcanon.c | |
parent | 8d2d69eba471b77adc69e80f224b841c41f48cf6 (diff) | |
download | gcc-78ea9abc2018243af7f7ada6135144ac90c6ad27.zip gcc-78ea9abc2018243af7f7ada6135144ac90c6ad27.tar.gz gcc-78ea9abc2018243af7f7ada6135144ac90c6ad27.tar.bz2 |
cfganal.h (rev_post_order_and_mark_dfs_back_seme): Declare.
2018-08-27 Richard Biener <rguenther@suse.de>
* cfganal.h (rev_post_order_and_mark_dfs_back_seme): Declare.
* cfganal.c (rev_post_order_and_mark_dfs_back_seme): New function.
* tree-ssa-sccvn.h (struct vn_pval): New structure.
(struct vn_nary_op_s): Add unwind_to member. Add
predicated_values flag and put result into a union together
with a linked list of vn_pval.
(struct vn_ssa_aux): Add name member to make maintaining
a map of SSA name to vn_ssa_aux possible. Remove no longer
needed info, dfsnum, low, visited, on_sccstack, use_processed
and range_info_anti_range_p members.
(run_scc_vn, vn_eliminate, free_scc_vn, vn_valueize): Remove.
(do_rpo_vn, run_rpo_vn, eliminate_with_rpo_vn, free_rpo_vn):
New functions.
(vn_valueize): New global.
(vn_context_bb): Likewise.
(VN_INFO_RANGE_INFO, VN_INFO_ANTI_RANGE_P, VN_INFO_RANGE_TYPE,
VN_INFO_PTR_INFO): Remove.
* tree-ssa-sccvn.c: ... (rewrite)
(pass_fre::execute): For -O2+ initialize loops and run
RPO VN in optimistic mode (iterating). For -O1 and -Og
run RPO VN in non-optimistic mode.
* params.def (PARAM_SCCVN_MAX_SCC_SIZE): Remove.
(PARAM_RPO_VN_MAX_LOOP_DEPTH): Add.
* doc/invoke.texi (sccvn-max-scc-size): Remove.
(rpo-vn-max-loop-depth): Document.
* tree-ssa-alias.c (walk_non_aliased_vuses): Stop walking
when valuezing the VUSE signals we walked out of the region.
* tree-ssa-pre.c (phi_translate_1): Ignore predicated values.
(phi_translate): Set VN context block to use for availability
lookup.
(compute_avail): Likewise.
(pre_valueize): New function.
(pass_pre::execute): Adjust to the RPO VN API.
* tree-ssa-loop-ivcanon.c: Include tree-ssa-sccvn.h.
(propagate_constants_for_unrolling): Remove.
(tree_unroll_loops_completely): Perform value-numbering
on the unrolled bodies loop parent.
* g++.dg/torture/20180705-1.C: New testcase.
* gcc.dg/tree-ssa/ssa-fre-67.c: Likewise.
* gcc.dg/tree-ssa/ssa-ccp-14.c: Scan FRE dump.
* gcc.dg/tree-ssa/ssa-fre-46.c: Use -O2.
* gcc.dg/tree-ssa/vrp92.c: Disable FRE.
* gcc.dg/pr83666.c: Drop --param=sccvn-max-scc-size option.
* gcc.dg/pr85195.c: Likewise.
* gcc.dg/pr85467.c: Likewise.
* gcc.dg/torture/pr81790.c: Likewise.
* gfortran.dg/reassoc_4.f: Change max-completely-peeled-insns
param to current default.
From-SVN: r263875
Diffstat (limited to 'gcc/tree-ssa-loop-ivcanon.c')
-rw-r--r-- | gcc/tree-ssa-loop-ivcanon.c | 57 |
1 files changed, 9 insertions, 48 deletions
diff --git a/gcc/tree-ssa-loop-ivcanon.c b/gcc/tree-ssa-loop-ivcanon.c index 326589f..97c2ad9 100644 --- a/gcc/tree-ssa-loop-ivcanon.c +++ b/gcc/tree-ssa-loop-ivcanon.c @@ -63,6 +63,7 @@ along with GCC; see the file COPYING3. If not see #include "tree-inline.h" #include "tree-cfgcleanup.h" #include "builtins.h" +#include "tree-ssa-sccvn.h" /* Specifies types of loops that may be unrolled. */ @@ -1318,50 +1319,6 @@ canonicalize_induction_variables (void) return 0; } -/* Propagate constant SSA_NAMEs defined in basic block BB. */ - -static void -propagate_constants_for_unrolling (basic_block bb) -{ - /* Look for degenerate PHI nodes with constant argument. */ - for (gphi_iterator gsi = gsi_start_phis (bb); !gsi_end_p (gsi); ) - { - gphi *phi = gsi.phi (); - tree result = gimple_phi_result (phi); - tree arg = gimple_phi_arg_def (phi, 0); - - if (! SSA_NAME_OCCURS_IN_ABNORMAL_PHI (result) - && gimple_phi_num_args (phi) == 1 - && CONSTANT_CLASS_P (arg)) - { - replace_uses_by (result, arg); - gsi_remove (&gsi, true); - release_ssa_name (result); - } - else - gsi_next (&gsi); - } - - /* Look for assignments to SSA names with constant RHS. */ - for (gimple_stmt_iterator gsi = gsi_start_bb (bb); !gsi_end_p (gsi); ) - { - gimple *stmt = gsi_stmt (gsi); - tree lhs; - - if (is_gimple_assign (stmt) - && TREE_CODE_CLASS (gimple_assign_rhs_code (stmt)) == tcc_constant - && (lhs = gimple_assign_lhs (stmt), TREE_CODE (lhs) == SSA_NAME) - && !SSA_NAME_OCCURS_IN_ABNORMAL_PHI (lhs)) - { - replace_uses_by (lhs, gimple_assign_rhs1 (stmt)); - gsi_remove (&gsi, true); - release_ssa_name (lhs); - } - else - gsi_next (&gsi); - } -} - /* Process loops from innermost to outer, stopping at the innermost loop we unrolled. */ @@ -1512,10 +1469,14 @@ tree_unroll_loops_completely (bool may_increase_size, bool unroll_outer) EXECUTE_IF_SET_IN_BITMAP (fathers, 0, i, bi) { loop_p father = get_loop (cfun, i); - basic_block *body = get_loop_body_in_dom_order (father); - for (unsigned j = 0; j < father->num_nodes; j++) - propagate_constants_for_unrolling (body[j]); - free (body); + bitmap exit_bbs = BITMAP_ALLOC (NULL); + loop_exit *exit = father->exits->next; + while (exit->e) + { + bitmap_set_bit (exit_bbs, exit->e->dest->index); + exit = exit->next; + } + do_rpo_vn (cfun, loop_preheader_edge (father), exit_bbs); } BITMAP_FREE (fathers); |