This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH][5/4] Fix PR87117
- From: Richard Biener <rguenther at suse dot de>
- To: gcc-patches at gcc dot gnu dot org
- Date: Tue, 28 Aug 2018 15:46:53 +0200 (CEST)
- Subject: [PATCH][5/4] Fix PR87117
Another one.
Bootstrapped on x86_64-unknown-linux-gnu, testing in progress.
Richard.
2018-08-28 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.
Index: gcc/tree-ssa-sccvn.c
===================================================================
--- gcc/tree-ssa-sccvn.c (revision 263917)
+++ gcc/tree-ssa-sccvn.c (working copy)
@@ -4979,8 +4979,14 @@ eliminate_dom_walker::eliminate_stmt (ba
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. */
@@ -5258,7 +5264,10 @@ eliminate_dom_walker::eliminate_stmt (ba
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;
}
Index: gcc/testsuite/gfortran.dg/pr87117.f90
===================================================================
--- gcc/testsuite/gfortran.dg/pr87117.f90 (nonexistent)
+++ gcc/testsuite/gfortran.dg/pr87117.f90 (working copy)
@@ -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