From patchwork Tue Nov 25 20:22:37 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Makarov X-Patchwork-Id: 414857 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]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id E4B8514019C for ; Wed, 26 Nov 2014 07:23:38 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:subject:content-type; q= dns; s=default; b=DoaJBKBvFp4aunoPYDtTII8az/NiQaV5pTtIxGiGL3QRfD +bxzGcKbfLScsIN1z1nhfOUkS4lo6CLdOv72XxZ2v+Q9BAWlYsOPtbUY9XSPZpmW pnumb3ihgoYl2g6NL2Tw+rmSsAcIxXU5/Y2QtKQ7jkcFlFo+ubsru0On0vipQ= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:subject:content-type; s= default; bh=f5HlbK5eCpSq8imPQew6uk4hASU=; b=FVgZWWdGU4PEhE+fR7mx 2yGSF4TctvR4/QO9J0xWZlSYaGscke3nrMtU66d2L940tgHWh7jtYs5l+hAk9n9V qQLdM4PbQUma4+u3H/Y04TktLQeR927dJ5oVlZw20Yo7G7bFNvBjGfIE3M0KOY2w NQcU4YEzDVeJv+2sJCCDzzI= Received: (qmail 8908 invoked by alias); 25 Nov 2014 20:22:41 -0000 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 Received: (qmail 8840 invoked by uid 89); 25 Nov 2014 20:22:40 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.7 required=5.0 tests=AWL, BAYES_00, SPF_HELO_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Tue, 25 Nov 2014 20:22:39 +0000 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id sAPKMbAd007612 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Tue, 25 Nov 2014 15:22:37 -0500 Received: from topor.usersys.redhat.com ([10.15.16.142]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id sAPKMb5j013559 for ; Tue, 25 Nov 2014 15:22:37 -0500 Message-ID: <5474E50D.5010205@redhat.com> Date: Tue, 25 Nov 2014 15:22:37 -0500 From: Vladimir Makarov User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: gcc-patches Subject: patch to fix PR63527 X-IsSubscribed: yes The following patch fixes https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63527 The patch was tested and bootstrapped on x86/x86-64. Committed as rev. 218509. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63527 Index: ira-lives.c =================================================================== --- ira-lives.c (revision 218058) +++ ira-lives.c (working copy) @@ -1123,8 +1123,10 @@ process_bb_node_lives (ira_loop_tree_nod pessimistic, but it probably doesn't matter much in practice. */ FOR_BB_INSNS_REVERSE (bb, insn) { + int regno; + ira_allocno_t a; df_ref def, use; - bool call_p; + bool call_p, clear_pic_use_conflict_p; if (!NONDEBUG_INSN_P (insn)) continue; @@ -1134,6 +1136,21 @@ process_bb_node_lives (ira_loop_tree_nod INSN_UID (insn), loop_tree_node->parent->loop_num, curr_point); + call_p = CALL_P (insn); + clear_pic_use_conflict_p = false; + /* Processing insn usage in call insn can create conflict + with pic pseudo and pic hard reg and that is wrong. + Check this situation and fix it at the end of the insn + processing. */ + if (call_p && pic_offset_table_rtx != NULL_RTX + && (regno = REGNO (pic_offset_table_rtx)) >= FIRST_PSEUDO_REGISTER + && (a = ira_curr_regno_allocno_map[regno]) != NULL) + clear_pic_use_conflict_p + = (find_regno_fusage (insn, USE, REAL_PIC_OFFSET_TABLE_REGNUM) + && ! TEST_HARD_REG_BIT (OBJECT_CONFLICT_HARD_REGS + (ALLOCNO_OBJECT (a, 0)), + REAL_PIC_OFFSET_TABLE_REGNUM)); + /* Mark each defined value as live. We need to do this for unused values because they still conflict with quantities that are live at the time of the definition. @@ -1143,7 +1160,6 @@ process_bb_node_lives (ira_loop_tree_nod on a call-clobbered register. Marking the register as live would stop us from allocating it to a call-crossing allocno. */ - call_p = CALL_P (insn); FOR_EACH_INSN_DEF (def, insn) if (!call_p || !DF_REF_FLAGS_IS_SET (def, DF_REF_MAY_CLOBBER)) mark_ref_live (def); @@ -1207,7 +1223,7 @@ process_bb_node_lives (ira_loop_tree_nod EXECUTE_IF_SET_IN_SPARSESET (objects_live, i) { ira_object_t obj = ira_object_id_map[i]; - ira_allocno_t a = OBJECT_ALLOCNO (obj); + a = OBJECT_ALLOCNO (obj); int num = ALLOCNO_NUM (a); HARD_REG_SET this_call_used_reg_set; @@ -1257,7 +1273,7 @@ process_bb_node_lives (ira_loop_tree_nod make_early_clobber_and_input_conflicts (); curr_point++; - + /* Mark each used value as live. */ FOR_EACH_INSN_USE (use, insn) mark_ref_live (use); @@ -1286,6 +1302,17 @@ process_bb_node_lives (ira_loop_tree_nod } } + if (clear_pic_use_conflict_p) + { + regno = REGNO (pic_offset_table_rtx); + a = ira_curr_regno_allocno_map[regno]; + CLEAR_HARD_REG_BIT (OBJECT_CONFLICT_HARD_REGS (ALLOCNO_OBJECT (a, 0)), + REAL_PIC_OFFSET_TABLE_REGNUM); + CLEAR_HARD_REG_BIT (OBJECT_TOTAL_CONFLICT_HARD_REGS + (ALLOCNO_OBJECT (a, 0)), + REAL_PIC_OFFSET_TABLE_REGNUM); + } + curr_point++; }