re PR tree-optimization/87117 (ICE in eliminate_dom_walker::eliminate_cleanup(bool...
authorRichard Biener <rguenther@suse.de>
Wed, 29 Aug 2018 06:49:06 +0000 (06:49 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Wed, 29 Aug 2018 06:49:06 +0000 (06:49 +0000)
2018-08-29  Richard Biener  <rguenther@suse.de>

PR tree-optimization/87117
* tree-ssa-sccvn.c (eliminate_dom_walker::eliminate_stmt): Only
re-value-number released SSA VDEFs.

* gfortran.dg/pr87117.f90: New testcase.

From-SVN: r263945

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/pr87117.f90 [new file with mode: 0644]
gcc/tree-ssa-sccvn.c

index 03a98c90ab28b21d33d63459eda3842e79a0b831..2c0f5023a2dc94aa76e7c8c2175ab3dda8000b25 100644 (file)
@@ -1,3 +1,9 @@
+2018-08-29  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/87117
+       * tree-ssa-sccvn.c (eliminate_dom_walker::eliminate_stmt): Only
+       re-value-number released SSA VDEFs.
+
 2018-08-29  Richard Biener  <rguenther@suse.de>
 
        PR tree-optimization/87126
index e6a9c8610cd282900d9cf009b17fb09eeb80dac1..765d4a1e11573bd26d986224e231a4c76adc7664 100644 (file)
@@ -1,3 +1,8 @@
+2018-08-29  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/87117
+       * gfortran.dg/pr87117.f90: New testcase.
+
 2018-08-29  Richard Biener  <rguenther@suse.de>
 
        PR tree-optimization/87126
diff --git a/gcc/testsuite/gfortran.dg/pr87117.f90 b/gcc/testsuite/gfortran.dg/pr87117.f90
new file mode 100644 (file)
index 0000000..afca653
--- /dev/null
@@ -0,0 +1,14 @@
+! { dg-do compile }
+! { dg-options "-O" }
+program p
+   real(4) :: a, b
+   integer(4) :: n, m
+   equivalence (a, n)
+   a = 1024.0
+   m = 8
+   a = 1024.0
+   b = set_exponent(a, m)
+   n = 8
+   a = f(a, n)
+   b = set_exponent(a, m)
+end
index aaac430bb46e1dda432f5f7ad5aac70cd4344857..04b3808feff42f863acfeb7cd2a55358b2a9ad0a 100644 (file)
@@ -4989,8 +4989,14 @@ eliminate_dom_walker::eliminate_stmt (basic_block b, gimple_stmt_iterator *gsi)
          propagate_tree_value_into_stmt (gsi, sprime);
          stmt = gsi_stmt (*gsi);
          update_stmt (stmt);
+         /* In case the VDEF on the original stmt was released, value-number
+            it to the VUSE.  This is to make vuse_ssa_val able to skip
+            released virtual operands.  */
          if (vdef != gimple_vdef (stmt))
-           VN_INFO (vdef)->valnum = vuse;
+           {
+             gcc_assert (SSA_NAME_IN_FREE_LIST (vdef));
+             VN_INFO (vdef)->valnum = vuse;
+           }
 
          /* If we removed EH side-effects from the statement, clean
             its EH information.  */
@@ -5268,7 +5274,10 @@ eliminate_dom_walker::eliminate_stmt (basic_block b, gimple_stmt_iterator *gsi)
            fprintf (dump_file, "  Removed AB side-effects.\n");
        }
       update_stmt (stmt);
-      if (vdef != gimple_vdef (stmt))
+      /* In case the VDEF on the original stmt was released, value-number
+         it to the VUSE.  This is to make vuse_ssa_val able to skip
+        released virtual operands.  */
+      if (vdef && SSA_NAME_IN_FREE_LIST (vdef))
        VN_INFO (vdef)->valnum = vuse;
     }