From patchwork Thu Jun 13 01:27:25 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Cheng X-Patchwork-Id: 250956 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 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "localhost", Issuer "www.qmailtoaster.com" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 1B9FD2C0084 for ; Thu, 13 Jun 2013 11:31:57 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type; q=dns; s= default; b=gy2aJbIn+Vzm0oEiBGLywBcX/tS25F0KtRCuAlGlJpg2kJQUoRxYP 7sPqTyKtO+dFeYyBx6Z3jNS/s3p7LjCoOTRG49ReQxdw9B9LWQzn0jRsEW6kvStw G9ZM99T/l4GLR2uAwQvctKsWCzgwRCNEH193rDaVgLUjUOIxjoykHA= 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:from :to:subject:date:message-id:mime-version:content-type; s= default; bh=JQ0HVeSaTYv43OUMEtcHugjZvyU=; b=UkO4P7uibBWo+mTWWwn4 y7JuQTZ9SEQAEnijEOIiqQJf5mg5kRUZzxhSB2tbX9SB+rHWHPeHdQ4S9RwGcXBN jHnKKXPmuHeAGa2QQgMRNKsHuB5RVCz/9Lv1K4e8u6A+IO/nXYcxIWZpQ3qD1ahf eSA2ZjPirJVrjnhSzXXO3/4= Received: (qmail 6636 invoked by alias); 13 Jun 2013 01:31:52 -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 6597 invoked by uid 89); 13 Jun 2013 01:31:48 -0000 X-Spam-SWARE-Status: No, score=-0.8 required=5.0 tests=AWL, BAYES_20, MSGID_MULTIPLE_AT, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=no version=3.3.1 Received: from service87.mimecast.com (HELO service87.mimecast.com) (91.220.42.44) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Thu, 13 Jun 2013 01:31:47 +0000 Received: from cam-owa2.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.21]) by service87.mimecast.com; Thu, 13 Jun 2013 02:31:44 +0100 Received: from Binsh02 ([10.1.255.212]) by cam-owa2.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.3959); Thu, 13 Jun 2013 02:31:43 +0100 From: "Bin Cheng" To: Subject: [PATCH GCC]Consider NOP_EXPR and CONVERT_EXPR as equal nodes in operand_equal_p Date: Thu, 13 Jun 2013 09:27:25 +0800 Message-ID: <00a401ce67d5$2ab87630$80296290$@cheng@arm.com> MIME-Version: 1.0 X-MC-Unique: 113061302314400201 X-Virus-Found: No Hi, This is a case of NOP_EXPR and CONVERT_EXPR not compared equal in operand_equal_p, resulting in below two nodes are considered different: NODE 0: unit size align 16 symtab 0 alias set 4 canonical type 0xb74602a0 precision 16 min max context pointer_to_this > arg 0 unit size align 32 symtab 0 alias set 5 canonical type 0xb7460420 precision 32 min max context pointer_to_this > visiteddef_stmt _23 = *_22; version 23>> NODE 1: unit size align 16 symtab 0 alias set 4 canonical type 0xb74602a0 precision 16 min max context pointer_to_this > arg 0 unit size align 32 symtab 0 alias set 5 canonical type 0xb7460420 precision 32 min max context pointer_to_this > visiteddef_stmt _23 = *_22; version 23>> This patch fixes the problem. Please refer to http://gcc.gnu.org/ml/gcc/2013-05/msg00199.html for more information. Bootstrap and test on x86 and cortex-a15. Is it OK? Thanks. bin 2013-06-13 Bin Cheng * fold-const.c (operand_equal_p): Consider NOP_EXPR and CONVERT_EXPR as equal nodes. Index: gcc/fold-const.c =================================================================== --- gcc/fold-const.c (revision 199844) +++ gcc/fold-const.c (working copy) @@ -2473,9 +2473,13 @@ operand_equal_p (const_tree arg0, const_tree arg1, } if (TREE_CODE (arg0) != TREE_CODE (arg1) - /* This is needed for conversions and for COMPONENT_REF. - Might as well play it safe and always test this. */ - || TREE_CODE (TREE_TYPE (arg0)) == ERROR_MARK + /* NOP_EXPR and CONVERT_EXPR are considered equal. */ + && !(CONVERT_EXPR_P (arg0) && CONVERT_EXPR_P (arg1))) + return 0; + + /* This is needed for conversions and for COMPONENT_REF. + Might as well play it safe and always test this. */ + if (TREE_CODE (TREE_TYPE (arg0)) == ERROR_MARK || TREE_CODE (TREE_TYPE (arg1)) == ERROR_MARK || TYPE_MODE (TREE_TYPE (arg0)) != TYPE_MODE (TREE_TYPE (arg1))) return 0;