From: Richard Biener Date: Thu, 6 Jun 2019 07:32:44 +0000 (+0000) Subject: vr-values.c (vr_values::extract_range_from_ssa_name): Do not put equivalences on... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=8ce6fb5fec60f0ce6363d2a41f30e5fc620a4beb;p=gcc.git vr-values.c (vr_values::extract_range_from_ssa_name): Do not put equivalences on UNDEFINED ranges. 2019-06-06 Richard Biener * vr-values.c (vr_values::extract_range_from_ssa_name): Do not put equivalences on UNDEFINED ranges. * gimple-ssa-evrp.c (evrp_dom_walker::before_dom_children): Make sure to drop defs of stmts added during simplification to VARYING. From-SVN: r271990 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 0cc05c76557..84c01ce3836 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2019-06-06 Richard Biener + + * vr-values.c (vr_values::extract_range_from_ssa_name): Do not + put equivalences on UNDEFINED ranges. + * gimple-ssa-evrp.c (evrp_dom_walker::before_dom_children): + Make sure to drop defs of stmts added during simplification + to VARYING. + 2019-06-06 Richard Biener * tree-ssa-structalias.c: Include tree-cfg.h. diff --git a/gcc/gimple-ssa-evrp.c b/gcc/gimple-ssa-evrp.c index 96da79bf028..16a8f7ffc23 100644 --- a/gcc/gimple-ssa-evrp.c +++ b/gcc/gimple-ssa-evrp.c @@ -175,6 +175,8 @@ evrp_dom_walker::before_dom_children (basic_block bb) /* Try folding stmts with the VR discovered. */ bool did_replace = evrp_folder.replace_uses_in (stmt); + gimple_stmt_iterator prev_gsi = gsi; + gsi_prev (&prev_gsi); if (fold_stmt (&gsi, follow_single_use_edges) || did_replace) { @@ -191,6 +193,21 @@ evrp_dom_walker::before_dom_children (basic_block bb) if (did_replace) { + /* If we wound up generating new stmts during folding + drop all their defs to VARYING. We can't easily + process them because we've already instantiated + ranges on uses on STMT that only hold after it. */ + if (gsi_end_p (prev_gsi)) + prev_gsi = gsi_start_bb (bb); + else + gsi_next (&prev_gsi); + while (gsi_stmt (prev_gsi) != gsi_stmt (gsi)) + { + evrp_range_analyzer.get_vr_values () + ->set_defs_to_varying (gsi_stmt (prev_gsi)); + gsi_next (&prev_gsi); + } + /* If we cleaned up EH information from the statement, remove EH edges. */ if (maybe_clean_or_replace_eh_stmt (old_stmt, stmt)) diff --git a/gcc/vr-values.c b/gcc/vr-values.c index b401516ae8e..9e58cbf7b2a 100644 --- a/gcc/vr-values.c +++ b/gcc/vr-values.c @@ -719,7 +719,8 @@ vr_values::extract_range_from_ssa_name (value_range *vr, tree var) else vr->set (var); - vr->equiv_add (var, get_value_range (var), &vrp_equiv_obstack); + if (!vr->undefined_p ()) + vr->equiv_add (var, get_value_range (var), &vrp_equiv_obstack); } /* Extract range information from a binary expression OP0 CODE OP1 based on