diff options
author | vries <vries@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-11-14 00:10:42 +0000 |
---|---|---|
committer | vries <vries@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-11-14 00:10:42 +0000 |
commit | b527c406657ea65992c795ce5800a0646cde8810 (patch) | |
tree | 374322382bce0dcc52445ff4261931542fd1ecae /gcc/tree-ssa-tail-merge.c | |
parent | ba09ff60163bac27faab82e5279db330f5e67656 (diff) | |
download | gcc-b527c406657ea65992c795ce5800a0646cde8810.tar.gz |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@204767 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-tail-merge.c')
-rw-r--r-- | gcc/tree-ssa-tail-merge.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/gcc/tree-ssa-tail-merge.c b/gcc/tree-ssa-tail-merge.c index ca69b23e4bb..c97da97f6d3 100644 --- a/gcc/tree-ssa-tail-merge.c +++ b/gcc/tree-ssa-tail-merge.c @@ -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); |