vr-values.c (vr_values::extract_range_from_ssa_name): Do not put equivalences on...
authorRichard Biener <rguenther@suse.de>
Thu, 6 Jun 2019 07:32:44 +0000 (07:32 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Thu, 6 Jun 2019 07:32:44 +0000 (07:32 +0000)
2019-06-06  Richard Biener  <rguenther@suse.de>

* 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

gcc/ChangeLog
gcc/gimple-ssa-evrp.c
gcc/vr-values.c

index 0cc05c765571fe0484b8b37774927a06f6600b73..84c01ce3836bd5ac3b07c18cbef067f1681dda16 100644 (file)
@@ -1,3 +1,11 @@
+2019-06-06  Richard Biener  <rguenther@suse.de>
+
+       * 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  <rguenther@suse.de>
 
        * tree-ssa-structalias.c: Include tree-cfg.h.
index 96da79bf0280c56986b52a106f4198093d20f9ce..16a8f7ffc23c0c703f6b9263cc0ac5735a50db86 100644 (file)
@@ -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))
index b401516ae8e465490ccd5a8ab42056f7513aeca7..9e58cbf7b2a08346ac50bc15d30d53c776779e1c 100644 (file)
@@ -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