From: Richard Biener Date: Thu, 29 Sep 2016 07:20:13 +0000 (+0000) Subject: tree-vrp.c (set_defs_to_varying): New helper avoiding writing to vr_const_varying. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=4d6484dd5891ae59bdf398406771b2e8d6fe5742;p=gcc.git tree-vrp.c (set_defs_to_varying): New helper avoiding writing to vr_const_varying. 2016-09-29 Richard Biener * tree-vrp.c (set_defs_to_varying): New helper avoiding writing to vr_const_varying. (vrp_initialize): Call it. (vrp_visit_stmt): Likewise. (evrp_dom_walker::before_dom_children): Likewise. From-SVN: r240612 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 56f7255a2b0..590b547456d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2016-09-29 Richard Biener + + * tree-vrp.c (set_defs_to_varying): New helper avoiding + writing to vr_const_varying. + (vrp_initialize): Call it. + (vrp_visit_stmt): Likewise. + (evrp_dom_walker::before_dom_children): Likewise. + 2016-09-29 Richard Biener * tree-vect-stmts.c (vectorizable_load): Avoid emitting vector diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c index e07e93be30e..dbff92f69ea 100644 --- a/gcc/tree-vrp.c +++ b/gcc/tree-vrp.c @@ -710,6 +710,23 @@ get_value_range (const_tree var) return vr; } +/* Set value-ranges of all SSA names defined by STMT to varying. */ + +static void +set_defs_to_varying (gimple *stmt) +{ + ssa_op_iter i; + tree def; + FOR_EACH_SSA_TREE_OPERAND (def, stmt, i, SSA_OP_DEF) + { + value_range *vr = get_value_range (def); + /* Avoid writing to vr_const_varying get_value_range may return. */ + if (vr->type != VR_VARYING) + set_value_range_to_varying (vr); + } +} + + /* Return true, if VAL1 and VAL2 are equal values for VRP purposes. */ static inline bool @@ -7022,10 +7039,7 @@ vrp_initialize () prop_set_simulate_again (stmt, true); else if (!stmt_interesting_for_vrp (stmt)) { - ssa_op_iter i; - tree def; - FOR_EACH_SSA_TREE_OPERAND (def, stmt, i, SSA_OP_DEF) - set_value_range_to_varying (get_value_range (def)); + set_defs_to_varying (stmt); prop_set_simulate_again (stmt, false); } else @@ -7901,8 +7915,6 @@ vrp_visit_stmt (gimple *stmt, edge *taken_edge_p, tree *output_p) { value_range vr = VR_INITIALIZER; tree lhs = gimple_get_lhs (stmt); - tree def; - ssa_op_iter iter; extract_range_from_stmt (stmt, taken_edge_p, output_p, &vr); if (*output_p) @@ -7997,8 +8009,7 @@ vrp_visit_stmt (gimple *stmt, edge *taken_edge_p, tree *output_p) /* All other statements produce nothing of interest for VRP, so mark their outputs varying and prevent further simulation. */ - FOR_EACH_SSA_TREE_OPERAND (def, stmt, iter, SSA_OP_DEF) - set_value_range_to_varying (get_value_range (def)); + set_defs_to_varying (stmt); return (*taken_edge_p) ? SSA_PROP_INTERESTING : SSA_PROP_VARYING; } @@ -10726,12 +10737,7 @@ evrp_dom_walker::before_dom_children (basic_block bb) && (vr.type == VR_RANGE || vr.type == VR_ANTI_RANGE)) update_value_range (output, &vr); else - { - tree def; - ssa_op_iter iter; - FOR_EACH_SSA_TREE_OPERAND (def, stmt, iter, SSA_OP_DEF) - set_value_range_to_varying (get_value_range (def)); - } + set_defs_to_varying (stmt); /* Try folding stmts with the VR discovered. */ bool did_replace @@ -10780,12 +10786,7 @@ evrp_dom_walker::before_dom_children (basic_block bb) } } else - { - tree def; - ssa_op_iter iter; - FOR_EACH_SSA_TREE_OPERAND (def, stmt, iter, SSA_OP_DEF) - set_value_range_to_varying (get_value_range (def)); - } + set_defs_to_varying (stmt); } bb->flags |= BB_VISITED; return NULL;