From b6366520fa4bdf20c884457f027b5c4701cd3bbe Mon Sep 17 00:00:00 2001 From: Tom de Vries Date: Thu, 14 Nov 2013 00:10:33 +0000 Subject: Factor out gimple_operand_equal_value_p from gimple_equal_p 2013-11-14 Tom de Vries * tree-ssa-tail-merge.c (gimple_operand_equal_value_p): Factor new function out of ... (gimple_equal_p): ... here. From-SVN: r204766 --- gcc/tree-ssa-tail-merge.c | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) (limited to 'gcc/tree-ssa-tail-merge.c') diff --git a/gcc/tree-ssa-tail-merge.c b/gcc/tree-ssa-tail-merge.c index 0967085..ca69b23 100644 --- a/gcc/tree-ssa-tail-merge.c +++ b/gcc/tree-ssa-tail-merge.c @@ -1076,6 +1076,24 @@ set_cluster (basic_block bb1, basic_block bb2) gcc_unreachable (); } +/* Return true if gimple operands T1 and T2 have the same value. */ + +static bool +gimple_operand_equal_value_p (tree t1, tree t2) +{ + if (t1 == t2) + return true; + + if (t1 == NULL_TREE + || t2 == NULL_TREE) + return false; + + if (operand_equal_p (t1, t2, 0)) + return true; + + return gvn_uses_equal (t1, t2); +} + /* Return true if gimple statements S1 and S2 are equal. Gimple_bb (s1) and gimple_bb (s2) are members of SAME_SUCC. */ @@ -1104,9 +1122,7 @@ gimple_equal_p (same_succ same_succ, gimple s1, gimple s2) { t1 = gimple_call_arg (s1, i); t2 = gimple_call_arg (s2, i); - if (operand_equal_p (t1, t2, 0)) - continue; - if (gvn_uses_equal (t1, t2)) + if (gimple_operand_equal_value_p (t1, t2)) continue; return false; } @@ -1136,14 +1152,12 @@ gimple_equal_p (same_succ same_succ, gimple s1, gimple s2) case GIMPLE_COND: t1 = gimple_cond_lhs (s1); t2 = gimple_cond_lhs (s2); - if (!operand_equal_p (t1, t2, 0) - && !gvn_uses_equal (t1, t2)) + if (!gimple_operand_equal_value_p (t1, t2)) return false; t1 = gimple_cond_rhs (s1); t2 = gimple_cond_rhs (s2); - if (!operand_equal_p (t1, t2, 0) - && !gvn_uses_equal (t1, t2)) + if (!gimple_operand_equal_value_p (t1, t2)) return false; code1 = gimple_expr_code (s1); -- cgit v1.1