From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29824 invoked by alias); 8 Apr 2011 22:32:02 -0000 Received: (qmail 29758 invoked by uid 22791); 8 Apr 2011 22:32:01 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from mel.act-europe.fr (HELO mel.act-europe.fr) (194.98.77.210) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 08 Apr 2011 22:31:50 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 6D2BACB021E for ; Sat, 9 Apr 2011 00:31:49 +0200 (CEST) Received: from mel.act-europe.fr ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 7Fyx6K+iINcT for ; Sat, 9 Apr 2011 00:31:46 +0200 (CEST) Received: from [192.168.1.2] (bon31-9-83-155-120-49.fbx.proxad.net [83.155.120.49]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mel.act-europe.fr (Postfix) with ESMTP id 64063CB0243 for ; Sat, 9 Apr 2011 00:31:46 +0200 (CEST) From: Eric Botcazou To: gcc-patches@gcc.gnu.org Subject: Small tweak to combine_validate_cost Date: Fri, 08 Apr 2011 22:32:00 -0000 User-Agent: KMail/1.9.9 MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_Hz4nNWxr8PHTj4q" Message-Id: <201104090031.35060.ebotcazou@adacore.com> Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2011-04/txt/msg00669.txt.bz2 --Boundary-00=_Hz4nNWxr8PHTj4q Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Content-length: 404 At the end of combine_validate_cost, when the combination is validated, the registered cost of I1 is zero-ed. This should be done for I0 as well. Bootstrapped/regtested on x86_64-suse-linux, applied on the mainline. 2011-04-08 Eric Botcazou * combine.c (combine_validate_cost): Adjust comments. Set registered cost of I0 to zero at the end, if any. -- Eric Botcazou --Boundary-00=_Hz4nNWxr8PHTj4q Content-Type: text/x-diff; charset="iso 8859-15"; name="p.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="p.diff" Content-length: 2137 Index: combine.c =================================================================== --- combine.c (revision 172166) +++ combine.c (working copy) @@ -789,14 +789,13 @@ do_SUBST_MODE (rtx *into, enum machine_m #define SUBST_MODE(INTO, NEWVAL) do_SUBST_MODE(&(INTO), (NEWVAL)) -/* Subroutine of try_combine. Determine whether the combine replacement - patterns NEWPAT, NEWI2PAT and NEWOTHERPAT are cheaper according to - insn_rtx_cost that the original instruction sequence I0, I1, I2, I3 and - undobuf.other_insn. Note that I1 and/or NEWI2PAT may be NULL_RTX. - NEWOTHERPAT and undobuf.other_insn may also both be NULL_RTX. This - function returns false, if the costs of all instructions can be - estimated, and the replacements are more expensive than the original - sequence. */ +/* Subroutine of try_combine. Determine whether the replacement patterns + NEWPAT, NEWI2PAT and NEWOTHERPAT are cheaper according to insn_rtx_cost + than the original sequence I0, I1, I2, I3 and undobuf.other_insn. Note + that I0, I1 and/or NEWI2PAT may be NULL_RTX. Similarly, NEWOTHERPAT and + undobuf.other_insn may also both be NULL_RTX. Return false if the cost + of all the instructions can be estimated and the replacements are more + expensive than the original sequence. */ static bool combine_validate_cost (rtx i0, rtx i1, rtx i2, rtx i3, rtx newpat, @@ -861,10 +860,9 @@ combine_validate_cost (rtx i0, rtx i1, r old_cost = 0; } - /* Disallow this recombination if both new_cost and old_cost are - greater than zero, and new_cost is greater than old cost. */ - if (old_cost > 0 - && new_cost > old_cost) + /* Disallow this combination if both new_cost and old_cost are greater than + zero, and new_cost is greater than old cost. */ + if (old_cost > 0 && new_cost > old_cost) { if (dump_file) { @@ -910,7 +908,11 @@ combine_validate_cost (rtx i0, rtx i1, r INSN_COST (i2) = new_i2_cost; INSN_COST (i3) = new_i3_cost; if (i1) - INSN_COST (i1) = 0; + { + INSN_COST (i1) = 0; + if (i0) + INSN_COST (i0) = 0; + } return true; } --Boundary-00=_Hz4nNWxr8PHTj4q--