From patchwork Sat Nov 9 15:54:51 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 289998 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 4FB382C0098 for ; Sun, 10 Nov 2013 02:55:22 +1100 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:cc:subject:content-type; q=dns; s=default; b=MIGscp4SmBgQt80JHLl1xk5gwePC0FDbnJVQYp0790m cNiPRO+qVVH5XbWjpYAQ9UdTUcfbxYP8atd6x31tikc9laAkeAU39/GT+s+hk0F/ A9U8Gr/Rhyz9w6VANPuXiXUktiSZ0lhruGgjCiFUoWSS6OhpUU4aC6Zzy5a+2ibw = DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:cc:subject:content-type; s=default; bh=kQS2Y8hculY3+ygl49tIlx/mcHo=; b=bYOfHyfd7cWlDBe+e My8wmnHsqMu2jAvwDLfc3w//WdPk4lZPnKRZcaYvVtROU/o+bkMWTJ6pl4bvdV9g pucjvpN6xdw3B/apDQSv7nZJR3feypMkrQoz3Ny6ano6PAL+Ey5RgrDGdaEtB87i DFZQYH70TUjhJw3X8aSzArFTGk= Received: (qmail 3347 invoked by alias); 9 Nov 2013 15:55:12 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 3338 invoked by uid 89); 9 Nov 2013 15:55:11 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.2 required=5.0 tests=AWL, BAYES_50, RDNS_NONE, URIBL_BLOCKED autolearn=no version=3.3.2 X-HELO: relay1.mentorg.com Received: from Unknown (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 09 Nov 2013 15:55:11 +0000 Received: from svr-orw-exc-10.mgc.mentorg.com ([147.34.98.58]) by relay1.mentorg.com with esmtp id 1VfAsB-0005yx-9p from Tom_deVries@mentor.com ; Sat, 09 Nov 2013 07:54:55 -0800 Received: from SVR-IES-FEM-01.mgc.mentorg.com ([137.202.0.104]) by SVR-ORW-EXC-10.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.4675); Sat, 9 Nov 2013 07:54:55 -0800 Received: from [127.0.0.1] (137.202.0.76) by SVR-IES-FEM-01.mgc.mentorg.com (137.202.0.104) with Microsoft SMTP Server id 14.2.247.3; Sat, 9 Nov 2013 15:54:53 +0000 Message-ID: <527E5ACB.60901@mentor.com> Date: Sat, 9 Nov 2013 16:54:51 +0100 From: Tom de Vries User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.1.0 MIME-Version: 1.0 To: Richard Biener CC: Subject: [PATCH] Factor out gimple_operand_equal_value_p from gimple_equal_p Richard, This patch factors out gimple_operand_equal_value_p from gimple_equal_p. Bootstrapped and regtested on x86_64. OK for trunk? Thanks, - Tom 2013-11-06 Tom de Vries * tree-ssa-tail-merge.c (gimple_operand_equal_value_p): Factor new function out of ... (gimple_equal_p): ... here. diff --git a/gcc/tree-ssa-tail-merge.c b/gcc/tree-ssa-tail-merge.c index 4223094..98b5882 100644 --- a/gcc/tree-ssa-tail-merge.c +++ b/gcc/tree-ssa-tail-merge.c @@ -1107,6 +1107,24 @@ gimple_dont_merge_p (gimple stmt) return false; } +/* 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. */ @@ -1135,9 +1153,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; } @@ -1167,14 +1183,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);