From patchwork Thu Jul 26 10:20:05 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Cheng X-Patchwork-Id: 173394 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]) by ozlabs.org (Postfix) with SMTP id 1228D2C0086 for ; Thu, 26 Jul 2012 20:22:01 +1000 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1343902922; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: From:To:Subject:Date:Message-ID:MIME-Version:Content-Type: Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:Sender:Delivered-To; bh=7kpHXiXT/5r4ZQlGZn+k pEtAvEY=; b=NuW3hOabtW+xcTsjmtMr/m+hAJ+7v305fjXU3V3HY54WUmbmXbmy waeD8Wd5B5qZivsONyzf1OAU22IJtqLu4NnlSuuMCg6AHilnAm7WySEJYp91Z5Pz sve2yUoD9aujO2jbyIMJ5JD5huuKW/842gbwO8RqzIgHUM/4EwyTltg= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:From:To:Subject:Date:Message-ID:MIME-Version:X-MC-Unique:Content-Type:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=FmM0JSZHj15rjxOrEQlNt9yMY4Pl0REorfjYYFxlzumntgKHXupfrIIooy3vEp jmvKMBc7j38aBCkmfdzkG9z9SqukfR3KMU50HEMpmFV2H1lC+vHxTYFji7yrBZKn i0PdYDFYq9TUnCFwN25OrfcB5K/kMf++rJzLGBxrq6QSI=; Received: (qmail 17244 invoked by alias); 26 Jul 2012 10:21:56 -0000 Received: (qmail 17236 invoked by uid 22791); 26 Jul 2012 10:21:55 -0000 X-SWARE-Spam-Status: No, hits=-1.3 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, MSGID_MULTIPLE_AT, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_NO X-Spam-Check-By: sourceware.org Received: from service87.mimecast.com (HELO service87.mimecast.com) (91.220.42.44) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 26 Jul 2012 10:21:43 +0000 Received: from cam-owa1.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.21]) by service87.mimecast.com; Thu, 26 Jul 2012 11:21:41 +0100 Received: from Binsh02 ([10.1.255.212]) by cam-owa1.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.0); Thu, 26 Jul 2012 11:23:02 +0100 From: "Bin Cheng" To: Subject: [PATCH]Remove duplicate check on BRANCH_COST in fold-const.c Date: Thu, 26 Jul 2012 18:20:05 +0800 Message-ID: <001801cd6b18$3b7e1c00$b27a5400$@cheng@arm.com> MIME-Version: 1.0 X-MC-Unique: 112072611214102101 X-IsSubscribed: yes 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 Hi, This patch removes the duplicate check on BRANCH_COST in fold_truth_andor. The BRANCH_COST condition removed is a duplicate of the default definition of LOGICAL_OP_NON_SHORT_CIRCUIT. All current targets (mips and rs6000) that provide non-default definitions of LOGICAL_OP_SHORT_CIRCUIT set it to 0, so this patch is therefore just a code cleanup and does not change behaviour in the compiler. I built mipsel-elf cross compiler and compared newlib/libstdc++ compiled by the patched/original compilers. Is it OK? Thanks 2012-07-26 Bin Cheng * fold-const.c (fold_truth_andor) Remove duplicated check on BRANCH_COST. Index: gcc/fold-const.c =================================================================== --- gcc/fold-const.c (revision 189835) +++ gcc/fold-const.c (working copy) @@ -8443,9 +8443,7 @@ if ((tem = fold_truth_andor_1 (loc, code, type, arg0, arg1)) != 0) return tem; - if ((BRANCH_COST (optimize_function_for_speed_p (cfun), - false) >= 2) - && LOGICAL_OP_NON_SHORT_CIRCUIT + if (LOGICAL_OP_NON_SHORT_CIRCUIT && (code == TRUTH_AND_EXPR || code == TRUTH_ANDIF_EXPR || code == TRUTH_OR_EXPR