Commit 66076dcb by Richard Biener Committed by Richard Biener

tree-ssa-sccvn.c (vn_reference_lookup_3): Valueize RHS when comparing against a…

tree-ssa-sccvn.c (vn_reference_lookup_3): Valueize RHS when comparing against a store with possibly the same value.

2019-07-05  Richard Biener  <rguenther@suse.de>

	* tree-ssa-sccvn.c (vn_reference_lookup_3): Valueize RHS
	when comparing against a store with possibly the same value.

	* gcc.dg/tree-ssa/ssa-fre-77.c: New testcase.

From-SVN: r273136
parent fb4697e3
2019-07-05 Richard Biener <rguenther@suse.de> 2019-07-05 Richard Biener <rguenther@suse.de>
* tree-ssa-sccvn.c (vn_reference_lookup_3): Valueize RHS
when comparing against a store with possibly the same value.
2019-07-05 Richard Biener <rguenther@suse.de>
PR tree-optimization/91091 PR tree-optimization/91091
* tree-ssa-alias.h (get_continuation_for_phi): Add tbaa_p parameter. * tree-ssa-alias.h (get_continuation_for_phi): Add tbaa_p parameter.
(walk_non_aliased_vuses): Likewise. (walk_non_aliased_vuses): Likewise.
......
2019-07-05 Richard Biener <rguenther@suse.de> 2019-07-05 Richard Biener <rguenther@suse.de>
* gcc.dg/tree-ssa/ssa-fre-77.c: New testcase.
2019-07-05 Richard Biener <rguenther@suse.de>
PR tree-optimization/91091 PR tree-optimization/91091
* gcc.dg/tree-ssa/pr91091-2.c: New testcase. * gcc.dg/tree-ssa/pr91091-2.c: New testcase.
* gcc.dg/tree-ssa/ssa-fre-70.c: Likewise. * gcc.dg/tree-ssa/ssa-fre-70.c: Likewise.
......
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-fre1" } */
int foo (int *p, int *q)
{
int x;
*p = 1;
x = *p;
*q = x;
return *p;
}
/* { dg-final { scan-tree-dump "return 1;" "fre1" } } */
...@@ -2047,9 +2047,11 @@ vn_reference_lookup_3 (ao_ref *ref, tree vuse, void *data_, ...@@ -2047,9 +2047,11 @@ vn_reference_lookup_3 (ao_ref *ref, tree vuse, void *data_,
if (res && res != (void *)-1) if (res && res != (void *)-1)
{ {
vn_reference_t vnresult = (vn_reference_t) res; vn_reference_t vnresult = (vn_reference_t) res;
tree rhs = gimple_assign_rhs1 (def_stmt);
if (TREE_CODE (rhs) == SSA_NAME)
rhs = SSA_VAL (rhs);
if (vnresult->result if (vnresult->result
&& operand_equal_p (vnresult->result, && operand_equal_p (vnresult->result, rhs, 0))
gimple_assign_rhs1 (def_stmt), 0))
return res; return res;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment