From patchwork Mon Jul 18 20:36:09 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 105356 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 99CE0B6F18 for ; Tue, 19 Jul 2011 06:36:26 +1000 (EST) Received: (qmail 10424 invoked by alias); 18 Jul 2011 20:36:24 -0000 Received: (qmail 10357 invoked by uid 22791); 18 Jul 2011 20:36:24 -0000 X-SWARE-Spam-Status: No, hits=-6.8 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_HI, 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; Mon, 18 Jul 2011 20:36:10 +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 p6IKa97G006513 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 18 Jul 2011 16:36:09 -0400 Received: from anchor.twiddle.net (vpn-226-15.phx2.redhat.com [10.3.226.15]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p6IKa9Uj010959 for ; Mon, 18 Jul 2011 16:36:09 -0400 Message-ID: <4E249939.9040208@redhat.com> Date: Mon, 18 Jul 2011 13:36:09 -0700 From: Richard Henderson User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110428 Fedora/3.1.10-1.fc15 Thunderbird/3.1.10 MIME-Version: 1.0 To: GCC Patches Subject: bb-reorder maintenance [3/n] 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 create_basic_block function will do the right thing with ordering the block label and the block note. No need for us to work hard at that within bb-reorder. r~ * bb-reorder.c (fix_crossing_conditional_branches): Emit all insns before calling create_basic_block. diff --git a/gcc/bb-reorder.c b/gcc/bb-reorder.c index 2660551..b884345 100644 --- a/gcc/bb-reorder.c +++ b/gcc/bb-reorder.c @@ -1522,7 +1522,6 @@ fix_crossing_conditional_branches (void) { basic_block cur_bb; basic_block new_bb; - basic_block last_bb; basic_block dest; edge succ1; edge succ2; @@ -1532,9 +1531,6 @@ fix_crossing_conditional_branches (void) rtx set_src; rtx old_label = NULL_RTX; rtx new_label; - rtx new_jump; - - last_bb = EXIT_BLOCK_PTR->prev_bb; FOR_EACH_BB (cur_bb) { @@ -1597,35 +1593,27 @@ fix_crossing_conditional_branches (void) new_label = block_label (new_bb); else { + basic_block last_bb; + rtx new_jump; + /* Create new basic block to be dest for conditional jump. */ - new_bb = create_basic_block (NULL, NULL, last_bb); - new_bb->aux = last_bb->aux; - last_bb->aux = new_bb; - last_bb = new_bb; /* Put appropriate instructions in new bb. */ new_label = gen_label_rtx (); - emit_label_before (new_label, BB_HEAD (new_bb)); + emit_label (new_label); BB_HEAD (new_bb) = new_label; - if (GET_CODE (old_label) == LABEL_REF) - { - old_label = JUMP_LABEL (old_jump); - new_jump = emit_jump_insn_after (gen_jump - (old_label), - BB_END (new_bb)); - } - else - { - gcc_assert (HAVE_return - && GET_CODE (old_label) == RETURN); - new_jump = emit_jump_insn_after (gen_return (), - BB_END (new_bb)); - } + gcc_assert (GET_CODE (old_label) == LABEL_REF); + old_label = JUMP_LABEL (old_jump); + new_jump = emit_jump_insn (gen_jump (old_label)); JUMP_LABEL (new_jump) = old_label; - BB_END (new_bb) = new_jump; + + last_bb = EXIT_BLOCK_PTR->prev_bb; + new_bb = create_basic_block (new_label, new_jump, last_bb); + new_bb->aux = last_bb->aux; + last_bb->aux = new_bb; emit_barrier_after_bb (new_bb);