From patchwork Fri Apr 22 01:30:56 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Stump X-Patchwork-Id: 92495 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 D18A2B6F71 for ; Fri, 22 Apr 2011 11:31:15 +1000 (EST) Received: (qmail 2580 invoked by alias); 22 Apr 2011 01:31:13 -0000 Received: (qmail 2566 invoked by uid 22791); 22 Apr 2011 01:31:12 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RFC_ABUSE_POST, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from qmta15.westchester.pa.mail.comcast.net (HELO qmta15.westchester.pa.mail.comcast.net) (76.96.59.228) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 22 Apr 2011 01:30:58 +0000 Received: from omta14.westchester.pa.mail.comcast.net ([76.96.62.60]) by qmta15.westchester.pa.mail.comcast.net with comcast id aRSr1g0031HzFnQ5FRWzTs; Fri, 22 Apr 2011 01:30:59 +0000 Received: from up.mrs.kithrup.com ([24.4.193.8]) by omta14.westchester.pa.mail.comcast.net with comcast id aRWx1g00M0BKwT43aRWyLG; Fri, 22 Apr 2011 01:30:58 +0000 From: Mike Stump Subject: fix up hot/cold partitioning on ports that don't have long conditional branches Date: Thu, 21 Apr 2011 18:30:56 -0700 Message-Id: <0DF7E8C3-0E32-45F7-AA64-3551505A061A@comcast.net> To: "gcc-patches@gcc.gnu.org Patches" Mime-Version: 1.0 (Apple Message framework v1084) 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 This patch fixes up hot/cold partitioning on ports that don't have long conditional branches. I'll note that the entire file has lots of other jump optimizations that are suspect. Ok? 2011-04-21 Mike Stump * reorg.c (relax_delay_slots): Don't delete a jump that crosses a section boundary. (follow_jumps): Don't replace a short conditional jump with a long conditional jump when the port doesn't have long conditional jumps. (fill_slots_from_thread): Pass insn to follow_jumps. (relax_delay_slots): Likewise. Index: reorg.c =================================================================== --- reorg.c (revision 1301) +++ reorg.c (working copy) @@ -2509,7 +2509,7 @@ since that tells caller to avoid changing the insn. */ static rtx -follow_jumps (rtx label) +follow_jumps (rtx label, rtx jump) { rtx insn; rtx next; @@ -2529,6 +2529,16 @@ { rtx tem; + /* If a label crosses a section boundary and we're thinking + about changing a conditional jump to be a conditional jump + across that boundary, don't do it if the port doesn't have + long conditional branches. We can however jump to the label + just before we cross such a boundary. */ + if (!HAS_LONG_COND_BRANCH + && find_reg_note (insn, REG_CROSSING_JUMP, NULL_RTX) + && (condjump_p (jump) || condjump_in_parallel_p (jump))) + return value; + /* If we have found a cycle, make the insn jump to itself. */ if (JUMP_LABEL (insn) == label) return label; @@ -2991,7 +3001,7 @@ && redirect_with_delay_list_safe_p (insn, JUMP_LABEL (new_thread), delay_list)) - new_thread = follow_jumps (JUMP_LABEL (new_thread)); + new_thread = follow_jumps (JUMP_LABEL (new_thread), new_thread); if (new_thread == 0) label = find_end_label (); @@ -3342,12 +3352,13 @@ && (condjump_p (insn) || condjump_in_parallel_p (insn)) && (target_label = JUMP_LABEL (insn)) != 0) { - target_label = skip_consecutive_labels (follow_jumps (target_label)); + target_label = skip_consecutive_labels (follow_jumps (target_label, insn)); if (target_label == 0) target_label = find_end_label (); if (target_label && next_active_insn (target_label) == next - && ! condjump_in_parallel_p (insn)) + && ! condjump_in_parallel_p (insn) + && find_reg_note (insn, REG_CROSSING_JUMP, NULL_RTX) == NULL_RTX) { delete_jump (insn); continue; @@ -3492,7 +3503,7 @@ { /* If this jump goes to another unconditional jump, thread it, but don't convert a jump into a RETURN here. */ - trial = skip_consecutive_labels (follow_jumps (target_label)); + trial = skip_consecutive_labels (follow_jumps (target_label, delay_insn)); if (trial == 0) trial = find_end_label ();