Handle GIMPLE_ASSIGNs with different vuse in gimple_equal_p
2013-11-14 Tom de Vries <tom@codesourcery.com> * tree-ssa-tail-merge.c (gimple_equal_p): Add test for structural equality for GIMPLE_ASSIGN. * gcc.dg/tail-merge-store.c: New test. From-SVN: r204767
This commit is contained in:
parent
b6366520fa
commit
b4e48861df
|
@ -1,3 +1,8 @@
|
|||
2013-11-14 Tom de Vries <tom@codesourcery.com>
|
||||
|
||||
* tree-ssa-tail-merge.c (gimple_equal_p): Add test for structural
|
||||
equality for GIMPLE_ASSIGN.
|
||||
|
||||
2013-11-14 Tom de Vries <tom@codesourcery.com>
|
||||
|
||||
* tree-ssa-tail-merge.c (gimple_operand_equal_value_p): Factor new
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
2013-11-14 Tom de Vries <tom@codesourcery.com>
|
||||
|
||||
* gcc.dg/tail-merge-store.c: New test.
|
||||
|
||||
2013-11-13 Andrew MacLeod <amacleod@redhat.com>
|
||||
|
||||
* testsuite/g++.dg/plugin/selfassign.c: Include gimple-iterator.h.
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
/* { dg-do compile } */
|
||||
/* { dg-options "-O2 -ftree-tail-merge -fdump-tree-pre" } */
|
||||
|
||||
int z;
|
||||
int x;
|
||||
|
||||
void
|
||||
f (int c, int d)
|
||||
{
|
||||
if (c)
|
||||
z = 5;
|
||||
else
|
||||
{
|
||||
if (d)
|
||||
x = 4;
|
||||
z = 5;
|
||||
}
|
||||
}
|
||||
|
||||
/* { dg-final { scan-tree-dump-times "duplicate of" 1 "pre"} } */
|
||||
/* { dg-final { scan-tree-dump-times "z = 5" 1 "pre"} } */
|
||||
/* { dg-final { cleanup-tree-dump "pre" } } */
|
|
@ -1142,8 +1142,17 @@ gimple_equal_p (same_succ same_succ, gimple s1, gimple s2)
|
|||
lhs2 = gimple_get_lhs (s2);
|
||||
if (TREE_CODE (lhs1) != SSA_NAME
|
||||
&& TREE_CODE (lhs2) != SSA_NAME)
|
||||
return (vn_valueize (gimple_vdef (s1))
|
||||
== vn_valueize (gimple_vdef (s2)));
|
||||
{
|
||||
/* If the vdef is the same, it's the same statement. */
|
||||
if (vn_valueize (gimple_vdef (s1))
|
||||
== vn_valueize (gimple_vdef (s2)))
|
||||
return true;
|
||||
|
||||
/* Test for structural equality. */
|
||||
return (operand_equal_p (lhs1, lhs2, 0)
|
||||
&& gimple_operand_equal_value_p (gimple_assign_rhs1 (s1),
|
||||
gimple_assign_rhs1 (s2)));
|
||||
}
|
||||
else if (TREE_CODE (lhs1) == SSA_NAME
|
||||
&& TREE_CODE (lhs2) == SSA_NAME)
|
||||
return vn_valueize (lhs1) == vn_valueize (lhs2);
|
||||
|
|
Loading…
Reference in New Issue