From patchwork Thu Oct 18 20:25:47 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Makarov X-Patchwork-Id: 192433 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 E05652C0092 for ; Fri, 19 Oct 2012 07:32:29 +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=1351197151; 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=Os5HUrR F6oGqSFNFWADx8Dt4OE0=; b=k0fRyIG1kRzwdqWFmfk2JmBvsGysOhCvoEcu5WI SABUotUQOeLiz5lLgaOiObCjZLAW4lnIPou6mP9GY+yYikzoz5DfjzE2T7kc83qc rRVz9OpSeGurhJXDaWh/tMUeGW0XSqj4ETI1uwkwpRWhsfcIhg+ikCmSOseja4U5 ggtM= 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=GkPBoRKHE7QehlZ2sMCWWSFbUyayn95rejzB6TwqZ3S5HRY1E86nsyKRGEEaWZ pOcCBob2C73yC84bEu4RmVYfn9Q0J/SMO1R5uLNs3zvhU3fmFHq1SSWHzLNuHNjz /kCa6UO6J1gNbo2c6ErOqrLHeq29v255jYZ9Q18hfqTHY=; Received: (qmail 6906 invoked by alias); 18 Oct 2012 20:32:26 -0000 Received: (qmail 6887 invoked by uid 22791); 18 Oct 2012 20:32:25 -0000 X-SWARE-Spam-Status: No, hits=-6.4 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, MAY_BE_FORGED, 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; Thu, 18 Oct 2012 20:32:16 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q9IKWGNc008757 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 18 Oct 2012 16:32:16 -0400 Received: from toll.usersys.redhat.com (unused [10.15.16.165] (may be forged)) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q9IKWEGZ022849 for ; Thu, 18 Oct 2012 16:32:15 -0400 Message-ID: <508065CB.6050200@redhat.com> Date: Thu, 18 Oct 2012 16:25:47 -0400 From: Vladimir Makarov User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121009 Thunderbird/16.0 MIME-Version: 1.0 To: gcc-patches Subject: [lra] patch to fix a SPEC2000 failure. 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 solves a wrong code generation for SPEC2000 galgel on x86. The reason of the failure was in wrong assignment after live range splitting which resulted in dead code elimination. Wrong assignment was a result of that LRA trusts allocation of IRA based on LIVE info meanwhile using LR-info itself. The patch was successfully bootstrapped and tested on x86/x86-64. Committed as rev.192576. 2012-10-18 Vladimir Makarov * lra-spills.c (spill_pseudos): Use df_get_live_in and df_get_live_out instead of DF_LR_IN and DF_LR_OUT. * lra-lives.c (process_bb_lives): Ditto. * lra-coalesce.c (lra_coalesce): Ditto. * lra-constraints.c (update_ebb_live_info): Ditto. (get_live_on_other_edges, inherit_in_ebb, lra_inheritance): Ditto. (remove_inheritance_pseudos): Ditto. Index: lra-coalesce.c =================================================================== --- lra-coalesce.c (revision 192534) +++ lra-coalesce.c (working copy) @@ -324,8 +324,8 @@ lra_coalesce (void) bitmap_initialize (&used_pseudos_bitmap, ®_obstack); FOR_EACH_BB (bb) { - update_live_info (DF_LR_IN (bb)); - update_live_info (DF_LR_OUT (bb)); + update_live_info (df_get_live_in (bb)); + update_live_info (df_get_live_out (bb)); FOR_BB_INSNS_SAFE (bb, insn, next) if (INSN_P (insn) && bitmap_bit_p (&involved_insns_bitmap, INSN_UID (insn))) Index: lra-constraints.c =================================================================== --- lra-constraints.c (revision 192544) +++ lra-constraints.c (working copy) @@ -4281,34 +4281,34 @@ update_ebb_live_info (rtx head, rtx tail { if (prev_bb != NULL) { - /* Update DF_LR_IN (prev_bb): */ + /* Update df_get_live_in (prev_bb): */ EXECUTE_IF_SET_IN_BITMAP (&check_only_regs, 0, j, bi) if (bitmap_bit_p (&live_regs, j)) - bitmap_set_bit (DF_LR_IN (prev_bb), j); + bitmap_set_bit (df_get_live_in (prev_bb), j); else - bitmap_clear_bit (DF_LR_IN (prev_bb), j); + bitmap_clear_bit (df_get_live_in (prev_bb), j); } if (curr_bb != last_bb) { - /* Update DF_LR_OUT (curr_bb): */ + /* Update df_get_live_out (curr_bb): */ EXECUTE_IF_SET_IN_BITMAP (&check_only_regs, 0, j, bi) { live_p = bitmap_bit_p (&live_regs, j); if (! live_p) FOR_EACH_EDGE (e, ei, curr_bb->succs) - if (bitmap_bit_p (DF_LR_IN (e->dest), j)) + if (bitmap_bit_p (df_get_live_in (e->dest), j)) { live_p = true; break; } if (live_p) - bitmap_set_bit (DF_LR_OUT (curr_bb), j); + bitmap_set_bit (df_get_live_out (curr_bb), j); else - bitmap_clear_bit (DF_LR_OUT (curr_bb), j); + bitmap_clear_bit (df_get_live_out (curr_bb), j); } } prev_bb = curr_bb; - bitmap_and (&live_regs, &check_only_regs, DF_LR_OUT (curr_bb)); + bitmap_and (&live_regs, &check_only_regs, df_get_live_out (curr_bb)); } if (DEBUG_INSN_P (curr_insn)) continue; @@ -4419,7 +4419,7 @@ get_live_on_other_edges (basic_block fro bitmap_clear (res); FOR_EACH_EDGE (e, ei, from->succs) if (e->dest != to) - bitmap_ior_into (res, DF_LR_IN (e->dest)); + bitmap_ior_into (res, df_get_live_in (e->dest)); if ((last = get_last_non_debug_insn (from)) == NULL_RTX || ! JUMP_P (last)) return; curr_id = lra_get_insn_recog_data (last); @@ -4476,7 +4476,7 @@ inherit_in_ebb (rtx head, rtx tail) { /* We are at the end of BB. Add qualified living pseudos for potential splitting. */ - to_process = DF_LR_OUT (curr_bb); + to_process = df_get_live_out (curr_bb); if (last_processed_bb != NULL) { /* We are somewhere in the middle of EBB. */ @@ -4490,7 +4490,7 @@ inherit_in_ebb (rtx head, rtx tail) && (! CALL_P (last_insn) || find_reg_note (last_insn, REG_NORETURN, NULL) == NULL_RTX)); - REG_SET_TO_HARD_REG_SET (live_hard_regs, DF_LR_OUT (curr_bb)); + REG_SET_TO_HARD_REG_SET (live_hard_regs, df_get_live_out (curr_bb)); IOR_HARD_REG_SET (live_hard_regs, eliminable_regset); IOR_HARD_REG_SET (live_hard_regs, lra_no_alloc_regs); CLEAR_HARD_REG_SET (potential_reload_hard_regs); @@ -4730,7 +4730,7 @@ inherit_in_ebb (rtx head, rtx tail) /* We reached the beginning of the current block -- do rest of spliting in the current BB. */ first_insn = get_first_non_debug_insn (curr_bb); - to_process = DF_LR_IN (curr_bb); + to_process = df_get_live_in (curr_bb); if (BLOCK_FOR_INSN (head) != curr_bb) { /* We are somewhere in the middle of EBB. */ @@ -4804,7 +4804,7 @@ lra_inheritance (void) fprintf (lra_dump_file, "EBB"); /* Form a EBB starting with BB. */ bitmap_clear (&ebb_global_regs); - bitmap_ior_into (&ebb_global_regs, DF_LR_IN (bb)); + bitmap_ior_into (&ebb_global_regs, df_get_live_in (bb)); for (;;) { if (lra_dump_file != NULL) @@ -4818,7 +4818,7 @@ lra_inheritance (void) break; bb = bb->next_bb; } - bitmap_ior_into (&ebb_global_regs, DF_LR_OUT (bb)); + bitmap_ior_into (&ebb_global_regs, df_get_live_out (bb)); if (lra_dump_file != NULL) fprintf (lra_dump_file, "\n"); if (inherit_in_ebb (BB_HEAD (start_bb), BB_END (bb))) @@ -4901,8 +4901,8 @@ remove_inheritance_pseudos (bitmap remov constraint pass. */ FOR_EACH_BB (bb) { - fix_bb_live_info (DF_LR_IN (bb), remove_pseudos); - fix_bb_live_info (DF_LR_OUT (bb), remove_pseudos); + fix_bb_live_info (df_get_live_in (bb), remove_pseudos); + fix_bb_live_info (df_get_live_out (bb), remove_pseudos); FOR_BB_INSNS_REVERSE (bb, curr_insn) { if (! INSN_P (curr_insn)) Index: lra-lives.c =================================================================== --- lra-lives.c (revision 192534) +++ lra-lives.c (working copy) @@ -490,7 +490,7 @@ process_bb_lives (basic_block bb, int &c rtx link, *link_loc; bool need_curr_point_incr; - reg_live_out = DF_LR_OUT (bb); + reg_live_out = df_get_live_out (bb); sparseset_clear (pseudos_live); sparseset_clear (pseudos_live_through_calls); sparseset_clear (pseudos_live_through_setjumps); @@ -747,7 +747,7 @@ process_bb_lives (basic_block bb, int &c EXECUTE_IF_SET_IN_SPARSESET (pseudos_live, i) mark_pseudo_dead (i, curr_point); - EXECUTE_IF_SET_IN_BITMAP (DF_LR_IN (bb), FIRST_PSEUDO_REGISTER, j, bi) + EXECUTE_IF_SET_IN_BITMAP (df_get_live_in (bb), FIRST_PSEUDO_REGISTER, j, bi) { if (sparseset_cardinality (pseudos_live_through_calls) == 0) break; Index: lra-spills.c =================================================================== --- lra-spills.c (revision 192544) +++ lra-spills.c (working copy) @@ -498,8 +498,8 @@ spill_pseudos (void) can miss the pseudo in some CALL_INSN_FUNCTION_USAGEs. */ remove_pseudos (&CALL_INSN_FUNCTION_USAGE (insn), insn); - bitmap_and_compl_into (DF_LR_IN (bb), &spilled_pseudos); - bitmap_and_compl_into (DF_LR_OUT (bb), &spilled_pseudos); + bitmap_and_compl_into (df_get_live_in (bb), &spilled_pseudos); + bitmap_and_compl_into (df_get_live_out (bb), &spilled_pseudos); } bitmap_clear (&spilled_pseudos); bitmap_clear (&changed_insns);