From patchwork Mon Mar 5 18:40:56 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Makarov X-Patchwork-Id: 144746 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 C0E94B6ED0 for ; Tue, 6 Mar 2012 05:41:20 +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=1331577681; 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=9GpVih/ yMuYEQKEKR0SWQdOQVIE=; b=HMF/QG1GyagxmAgEN5fnnaO3NkaC97RtenUB2LM sZvckhmFT0SnuMvjCEqa9MiAC4Y1qhxPvvoxLvG5FaPmup7GIEp63N44x5tnad7Q qdTnrCxviZirL7l5qzztvFK7H5Hlk0aK0dDB+B9kpo6PSAHLo0imA9rLAOWLKvvW 05XA= 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=i8N48WCgO7Zp/afRHU2a+R7go1EvKLC5hrSJMnV9sGay+UOhwrNlVWieiCzhHx ER+Fn2odCSJEtYKYyovpyZ04RLohT9Pst7MGKxMOcAxKCHNOT0cdVRP7HPdcOBB0 AVyV+TOSx7cI7tNDa2KVoVU0pMAtGOm3esmitcBz/Okas=; Received: (qmail 4541 invoked by alias); 5 Mar 2012 18:41:11 -0000 Received: (qmail 4481 invoked by uid 22791); 5 Mar 2012 18:41:10 -0000 X-SWARE-Spam-Status: No, hits=-6.5 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_HI, SPF_HELO_PASS, T_RP_MATCHES_RCVD 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; Mon, 05 Mar 2012 18:40:57 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q25IevE4025866 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 5 Mar 2012 13:40:57 -0500 Received: from toll.yyz.redhat.com (unused [10.15.16.165] (may be forged)) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q25Ieu90024599 for ; Mon, 5 Mar 2012 13:40:56 -0500 Message-ID: <4F5508B8.80908@redhat.com> Date: Mon, 05 Mar 2012 13:40:56 -0500 From: Vladimir Makarov User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.24) Gecko/20111108 Fedora/3.1.16-1.fc14 Thunderbird/3.1.16 MIME-Version: 1.0 To: gcc-patches Subject: [lra] a patch to fix a live-range splitting problem in EBB 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 some targets in rare cases, LRA can put a live-range splitting insn right after a jump insn setting up the split pseudo. The following patch fixes the problem by putting such insn at the beginning of next BB. The patch was successfully bootstrapped on x86/x86-64. Committed as rev. 184942. 2012-03-05 Vladimir Makarov * lra-constraints.c (simplify_operand_subreg): Treat out subreg operand which is a part of the pseudo as in/out one. (get_live_on_other_edges): Move lower and add non-input operands of jump to the bitmap. Index: lra-constraints.c =================================================================== --- lra-constraints.c (revision 184749) +++ lra-constraints.c (working copy) @@ -1371,7 +1371,8 @@ simplify_operand_subreg (int nop, enum m = (enum reg_class) targetm.preferred_reload_class (reg, ALL_REGS); if (get_reload_reg (type, reg_mode, reg, rclass, "subreg reg", &new_reg) - && type != OP_OUT) + && (type != OP_OUT + || GET_MODE_SIZE (GET_MODE (reg)) > GET_MODE_SIZE (mode))) { push_to_sequence (before); lra_emit_move (new_reg, reg); @@ -4214,21 +4215,6 @@ add_to_inherit (int regno, rtx insns) to_inherit[to_inherit_num++].insns = insns; } -/* Set up RES by registers living on edges FROM except edege (FROM, - TO). */ -static void -get_live_on_other_edges (basic_block from, basic_block to, bitmap res) -{ - edge e; - edge_iterator ei; - - gcc_assert (to != NULL); - bitmap_clear (res); - FOR_EACH_EDGE (e, ei, from->succs) - if (e->dest != to) - bitmap_ior_into (res, DF_LR_IN (e->dest)); -} - /* Return first (if FIRST_P) or last non-debug insn in basic block BB. Return null if there are no non-debug insns in the block. */ static rtx @@ -4245,6 +4231,31 @@ get_non_debug_insn (bool first_p, basic_ return insn; } +/* Set up RES by registers living on edges FROM except edge (FROM, TO) + or by registers set up in a jump insn in BB FROM. */ +static void +get_live_on_other_edges (basic_block from, basic_block to, bitmap res) +{ + int regno; + rtx last; + struct lra_insn_reg *reg; + edge e; + edge_iterator ei; + + gcc_assert (to != NULL); + bitmap_clear (res); + FOR_EACH_EDGE (e, ei, from->succs) + if (e->dest != to) + bitmap_ior_into (res, DF_LR_IN (e->dest)); + if ((last = get_non_debug_insn (false, from)) == NULL_RTX || ! JUMP_P (last)) + return; + curr_id = lra_get_insn_recog_data (last); + for (reg = curr_id->regs; reg != NULL; reg = reg->next) + if (reg->type != OP_IN + && (regno = reg->regno) >= FIRST_PSEUDO_REGISTER) + bitmap_set_bit (res, regno); +} + /* Used as a temporary results of some bitmap calculations. */ static bitmap_head temp_bitmap;