From patchwork Tue Mar 5 22:33:37 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 225189 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 E22512C007C for ; Wed, 6 Mar 2013 09:34:01 +1100 (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=1363127642; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Received:Date:From:To:Cc:Subject:Message-ID:Reply-To: References:MIME-Version:Content-Type:Content-Disposition: In-Reply-To:User-Agent:Mailing-List:Precedence:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:Sender: Delivered-To; bh=lcM7/jNwG7uIqthuNr7Mpv7/GWU=; b=mjnjNHbWM4l7+jO ySqqH86RFXWwqvEMx4Cx7CEDaYKTYMKFqLieERHgz7jjzetpPX7KLny3tGlL47XY xW3jZsdDqgFf7NZ1eWjN5qWqIZtdva0KmYkZEFscp0KLq7WJqSq2LMuAjrlyjq1W wfN0FRIINm9QbaTGxU3RhjOmGUbc= 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:Received:Received:Date:From:To:Cc:Subject:Message-ID:Reply-To:References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To:User-Agent:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=xjzAGNfGkN33v7W9wvAzdAvvhhCV0KhnEZRpMGdDy5ZvLiF+Gp7ZCX7K7H1HMG dC1XskAlodLXk5vggmw7bDYfxk8RshPuAokrOqEzyN4pPTZRsLIxliV2ZWu4O6+E GmSoyp7QNXwdDsQfzl0txhJqTBF1AsfQLY9Ui/y41JLzs=; Received: (qmail 2544 invoked by alias); 5 Mar 2013 22:33:49 -0000 Received: (qmail 2504 invoked by uid 22791); 5 Mar 2013 22:33:48 -0000 X-SWARE-Spam-Status: No, hits=-6.6 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, KHOP_SPAMHAUS_DROP, RCVD_IN_DNSWL_HI, RCVD_IN_HOSTKARMA_W, RP_MATCHES_RCVD, SPF_HELO_PASS, TW_FC X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 05 Mar 2013 22:33:42 +0000 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r25MXeFr001062 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 5 Mar 2013 17:33:40 -0500 Received: from zalov.cz (vpn1-7-250.ams2.redhat.com [10.36.7.250]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r25MXcLl016499 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 5 Mar 2013 17:33:40 -0500 Received: from zalov.cz (localhost [127.0.0.1]) by zalov.cz (8.14.5/8.14.5) with ESMTP id r25MXbYI014624; Tue, 5 Mar 2013 23:33:38 +0100 Received: (from jakub@localhost) by zalov.cz (8.14.5/8.14.5/Submit) id r25MXbaG014623; Tue, 5 Mar 2013 23:33:37 +0100 Date: Tue, 5 Mar 2013 23:33:37 +0100 From: Jakub Jelinek To: Eric Botcazou Cc: gcc-patches@gcc.gnu.org, Uros Bizjak Subject: Re: [PATCH] Avoid extending lifetime of likely spilled hard regs in ifcvt before reload (PR rtl-optimization/56484) Message-ID: <20130305223337.GN12913@tucnak.redhat.com> Reply-To: Jakub Jelinek References: <20130305162646.GJ12913@tucnak.redhat.com> <3897593.89GmqB5X3k@polaris> <20130305220313.GL12913@tucnak.redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20130305220313.GL12913@tucnak.redhat.com> User-Agent: Mutt/1.5.21 (2010-09-15) 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 On Tue, Mar 05, 2013 at 11:03:13PM +0100, Jakub Jelinek wrote: > > ifcvt.c tests only small_register_classes_for_mode_p in the other places, so > > do you really need class_likely_spilled_p here? > > I guess I don't. I've grepped for small_register_classes_for_mode_p and didn't see > anything in i386, so I figured out that it would be using a default (which > is false). But apparently it uses hook_bool_mode_true, so it is a superset > of class_likely_spilled_p, guess I can leave that out. Here is what I've actually committed (I've also removed the !reload_completed &&, because noce_process_if_block is only called for !!reload_completed (the only caller asserts it)). 2013-03-05 Jakub Jelinek PR rtl-optimization/56484 * ifcvt.c (noce_process_if_block): If else_bb is NULL, avoid extending lifetimes of hard registers on small register class machines. * gcc.c-torture/compile/pr56484.c: New test. Jakub --- gcc/ifcvt.c.jj 2013-03-05 15:12:15.284564443 +0100 +++ gcc/ifcvt.c 2013-03-05 23:11:25.751625601 +0100 @@ -2491,6 +2491,12 @@ noce_process_if_block (struct noce_if_in || ! noce_operand_ok (SET_SRC (set_b)) || reg_overlap_mentioned_p (x, SET_SRC (set_b)) || modified_between_p (SET_SRC (set_b), insn_b, jump) + /* Avoid extending the lifetime of hard registers on small + register class machines. */ + || (REG_P (SET_SRC (set_b)) + && HARD_REGISTER_P (SET_SRC (set_b)) + && targetm.small_register_classes_for_mode_p + (GET_MODE (SET_SRC (set_b)))) /* Likewise with X. In particular this can happen when noce_get_condition looks farther back in the instruction stream than one might expect. */ --- gcc/testsuite/gcc.c-torture/compile/pr56484.c.jj 2013-03-05 16:57:50.416961638 +0100 +++ gcc/testsuite/gcc.c-torture/compile/pr56484.c 2013-03-05 16:57:50.417961672 +0100 @@ -0,0 +1,17 @@ +/* PR rtl-optimization/56484 */ + +unsigned char b[4096]; +int bar (void); + +int +foo (void) +{ + int a = 0; + while (bar ()) + { + int c = bar (); + a = a < 0 ? a : c; + __builtin_memset (b, 0, sizeof b); + } + return a; +}