diff options
author | Richard Biener <rguenther@suse.de> | 2016-10-07 13:47:40 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2016-10-07 13:47:40 +0000 |
commit | d7f336f846f4333c3e55cc222fba21b4bc154119 (patch) | |
tree | 4f3aacf0249259991ac7ae2c63b406c8b1311937 /gcc/tree-ssa-propagate.c | |
parent | a9172bf307dd49fa001387f4b514ea49d38f2092 (diff) | |
download | gcc-d7f336f846f4333c3e55cc222fba21b4bc154119.zip gcc-d7f336f846f4333c3e55cc222fba21b4bc154119.tar.gz gcc-d7f336f846f4333c3e55cc222fba21b4bc154119.tar.bz2 |
tree-ssa-propagate.c (replace_phi_args_in): Remove no longer required hack.
2016-10-07 Richard Biener <rguenther@suse.de>
* tree-ssa-propagate.c (replace_phi_args_in): Remove no longer
required hack.
(substitute_and_fold_dom_walker::before_dom_children):
Substitute and fold before pass specific folding to avoid
feeding that with SSA names that will be later released.
* tree-ssa-ccp.c (get_value_for_expr): Guard for new SSA names
introduced by folding and visited by evaluate_stmt called during
ccp_fold_stmt.
(likely_value): Likewise.
(evaluate_stmt): Likewise.
* tree-vrp.c (simplify_truth_ops_using_ranges): Fold modified stmt.
(simplify_div_or_mod_using_ranges): Likewise.
(simplify_min_or_max_using_ranges): Likewise.
(simplify_abs_using_ranges): Likewise.
(simplify_conversion_using_ranges): Likewise.
(simplify_float_conversion_using_ranges): Likewise.
(simplify_stmt_using_ranges): Likewise.
* gcc.dg/tree-ssa/vrp01.c: Adjust.
* gcc.dg/tree-ssa/vrp34.c: Likewise.
From-SVN: r240865
Diffstat (limited to 'gcc/tree-ssa-propagate.c')
-rw-r--r-- | gcc/tree-ssa-propagate.c | 45 |
1 files changed, 18 insertions, 27 deletions
diff --git a/gcc/tree-ssa-propagate.c b/gcc/tree-ssa-propagate.c index 97cfde5..cd1cbd2 100644 --- a/gcc/tree-ssa-propagate.c +++ b/gcc/tree-ssa-propagate.c @@ -914,7 +914,6 @@ replace_phi_args_in (gphi *phi, ssa_prop_get_value_fn get_value) print_gimple_stmt (dump_file, phi, 0, TDF_SLIM); } - basic_block bb = gimple_bb (phi); for (i = 0; i < gimple_phi_num_args (phi); i++) { tree arg = gimple_phi_arg_def (phi, i); @@ -927,19 +926,6 @@ replace_phi_args_in (gphi *phi, ssa_prop_get_value_fn get_value) { edge e = gimple_phi_arg_edge (phi, i); - /* Avoid propagating constants into loop latch edge - PHI arguments as this makes coalescing the copy - across this edge impossible. If the argument is - defined by an assert - otherwise the stmt will - get removed without replacing its uses. */ - if (TREE_CODE (val) != SSA_NAME - && bb->loop_father->header == bb - && dominated_by_p (CDI_DOMINATORS, e->src, bb) - && is_gimple_assign (SSA_NAME_DEF_STMT (arg)) - && (gimple_assign_rhs_code (SSA_NAME_DEF_STMT (arg)) - == ASSERT_EXPR)) - continue; - if (TREE_CODE (val) != SSA_NAME) prop_stats.num_const_prop++; else @@ -1090,18 +1076,6 @@ substitute_and_fold_dom_walker::before_dom_children (basic_block bb) bool was_noreturn = (is_gimple_call (stmt) && gimple_call_noreturn_p (stmt)); - /* Some statements may be simplified using propagator - specific information. Do this before propagating - into the stmt to not disturb pass specific information. */ - if (fold_fn - && (*fold_fn)(&i)) - { - did_replace = true; - prop_stats.num_stmts_folded++; - stmt = gsi_stmt (i); - update_stmt (stmt); - } - /* Replace real uses in the statement. */ did_replace |= replace_uses_in (stmt, get_value_fn); @@ -1110,6 +1084,22 @@ substitute_and_fold_dom_walker::before_dom_children (basic_block bb) { fold_stmt (&i, follow_single_use_edges); stmt = gsi_stmt (i); + gimple_set_modified (stmt, true); + } + + /* Some statements may be simplified using propagator + specific information. Do this before propagating + into the stmt to not disturb pass specific information. */ + if (fold_fn) + { + update_stmt_if_modified (stmt); + if ((*fold_fn)(&i)) + { + did_replace = true; + prop_stats.num_stmts_folded++; + stmt = gsi_stmt (i); + gimple_set_modified (stmt, true); + } } /* If this is a control statement the propagator left edges @@ -1127,6 +1117,7 @@ substitute_and_fold_dom_walker::before_dom_children (basic_block bb) gimple_cond_make_true (as_a <gcond *> (stmt)); else gimple_cond_make_false (as_a <gcond *> (stmt)); + gimple_set_modified (stmt, true); did_replace = true; } } @@ -1155,7 +1146,7 @@ substitute_and_fold_dom_walker::before_dom_children (basic_block bb) } /* Determine what needs to be done to update the SSA form. */ - update_stmt (stmt); + update_stmt_if_modified (stmt); if (!is_gimple_debug (stmt)) something_changed = true; } |