From patchwork Wed Oct 24 20:02:48 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Makarov X-Patchwork-Id: 193942 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 63C9B2C0090 for ; Thu, 25 Oct 2012 07:03:06 +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=1351713787; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Message-ID:Date:From:User-Agent:MIME-Version:To:Subject: Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:Sender:Delivered-To; bh=FMacRet nccvOkVa58NVeWHW8JHk=; b=KbmpU3OjT2eJZXedD/6o8hfhy1o67lOGJK60N5j RYwsosxVLkWx4oy4eUcBAfwkZ/bnadSrxTwzh1G0Bm2k4/i+sA51L7phg8583Cg0 DGQMZHidU/yQANW6LcBTv8u18yYvNnK+cRLNhwWsft04vsLEwSjzDYj6L9ldjvd6 cMCA= 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:Message-ID:Date:From:User-Agent:MIME-Version:To:Subject:Content-Type:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=bZ/1S50vjZdcBFpGlPTjFeQxvUds+xfv8Pd5JImq5fj049dnwLe6AntzvBWVGp qljM4xrlok3joL153SawPnr/Ajgvd+O10Fgw54euZHEoyfMRU/H/V+6u5sDV5jpE zbCuDYFoNisbYX8hCGQPZe5GMHI3/a9cjEsu4+b3tRCec=; Received: (qmail 8408 invoked by alias); 24 Oct 2012 20:03:01 -0000 Received: (qmail 8395 invoked by uid 22791); 24 Oct 2012 20:03:01 -0000 X-SWARE-Spam-Status: No, hits=-6.8 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, RCVD_IN_DNSWL_HI, RCVD_IN_HOSTKARMA_W, RP_MATCHES_RCVD, SPF_HELO_PASS 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; Wed, 24 Oct 2012 20:02:50 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q9OK2n1K025776 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 24 Oct 2012 16:02:49 -0400 Received: from Mair.local (vpn-11-145.rdu.redhat.com [10.11.11.145]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q9OK2m2Q027085 for ; Wed, 24 Oct 2012 16:02:48 -0400 Message-ID: <50884968.9020109@redhat.com> Date: Wed, 24 Oct 2012 16:02:48 -0400 From: Vladimir Makarov User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:16.0) Gecko/20121010 Thunderbird/16.0.1 MIME-Version: 1.0 To: GCC Patches Subject: patch to fix PR55055 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 The following patch fix http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55055 In this case, operand was an address containing subreg. LRA before the patch processed only operands which are subregs of regs. The patch was successfully bootstrapped on x86/x86-64. Committed as rev. 192779. 2012-10-24 Vladimir Makarov PR rtl-optimization/55055 * lra-spills.c (alter_subregs): New function. (lra_hard_reg_substitution): Use it. Index: lra-spills.c =================================================================== --- lra-spills.c (revision 192742) +++ lra-spills.c (working copy) @@ -571,6 +571,48 @@ lra_spill (void) free (pseudo_regnos); } +/* Apply alter_subreg for subregs of regs in *LOC. Use FINAL_P for + alter_subreg calls. Return true if any subreg of reg is + processed. */ +static bool +alter_subregs (rtx *loc, bool final_p) +{ + int i; + rtx x = *loc; + bool res; + const char *fmt; + enum rtx_code code; + + if (x == NULL_RTX) + return false; + code = GET_CODE (x); + if (code == SUBREG && REG_P (SUBREG_REG (x))) + { + lra_assert (REGNO (SUBREG_REG (x)) < FIRST_PSEUDO_REGISTER); + alter_subreg (loc, final_p); + return true; + } + fmt = GET_RTX_FORMAT (code); + res = false; + for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--) + { + if (fmt[i] == 'e') + { + if (alter_subregs (&XEXP (x, i), final_p)) + res = true; + } + else if (fmt[i] == 'E') + { + int j; + + for (j = XVECLEN (x, i) - 1; j >= 0; j--) + if (alter_subregs (&XVECEXP (x, i, j), final_p)) + res = true; + } + } + return res; +} + /* Final change of pseudos got hard registers into the corresponding hard registers. */ void @@ -589,22 +631,15 @@ lra_hard_reg_substitution (void) FOR_BB_INSNS (bb, insn) if (INSN_P (insn)) { - lra_insn_recog_data_t id; + lra_insn_recog_data_t id = lra_get_insn_recog_data (insn); bool insn_change_p = false; - id = lra_get_insn_recog_data (insn); for (i = id->insn_static_data->n_operands - 1; i >= 0; i--) - { - rtx op = *id->operand_loc[i]; - - if (GET_CODE (op) == SUBREG && REG_P (SUBREG_REG (op))) - { - lra_assert (REGNO (SUBREG_REG (op)) < FIRST_PSEUDO_REGISTER); - alter_subreg (id->operand_loc[i], ! DEBUG_INSN_P (insn)); - lra_update_dup (id, i); - insn_change_p = true; - } - } + if (alter_subregs (id->operand_loc[i], ! DEBUG_INSN_P (insn))) + { + lra_update_dup (id, i); + insn_change_p = true; + } if (insn_change_p) lra_update_operator_dups (id); }