From patchwork Mon Mar 5 11:14:03 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 144659 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 3F0F4B6EEE for ; Mon, 5 Mar 2012 22:14:27 +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=1331550869; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Received:Date:From:To:Cc:Subject:Message-ID:Reply-To: MIME-Version:Content-Type:Content-Disposition:User-Agent: Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:Sender:Delivered-To; bh=JMd8s40HFgwUpVDQGIW9 Y8K+UtM=; b=g/BJbDNAfuv/6VMyRSXf3qol3d4mAIoleTn1AhpY7HyA7Bu+FQx+ behhKtNYculwwHfsusinIOS+JPY4DuYECn7DHShvMe5PwfXB0TCMmHqZcwUq4Cp3 vtV4FGgE1yhpcYueuq5+ug6TD58a9l+j7bNp657HKjh/umbRZMu8tt0= 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:Received:Received:Date:From:To:Cc:Subject:Message-ID:Reply-To:MIME-Version:Content-Type:Content-Disposition:User-Agent:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=bTSR9y8X6ZleCYnhNTmMNjl3eZ9ARcRUoeN/h+b2bJHeqCCDqyDpkG2FRKoESA kfv7YtCqqt9y8R/vN8K63kHnbN7D5Ae1XqBhVxJi4huqNFsQjz8Jzp30jTL0Ab/+ /2Qdil00+2GKFSDzPswulhuJYCFR9K1StoN7m2ZPu4y2E=; Received: (qmail 6096 invoked by alias); 5 Mar 2012 11:14:21 -0000 Received: (qmail 6087 invoked by uid 22791); 5 Mar 2012 11:14:20 -0000 X-SWARE-Spam-Status: No, hits=-6.7 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 11:14:06 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q25BE5Ln015137 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 5 Mar 2012 06:14:05 -0500 Received: from tyan-ft48-01.lab.bos.redhat.com (tyan-ft48-01.lab.bos.redhat.com [10.16.42.4]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q25BE4uB014946 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 5 Mar 2012 06:14:05 -0500 Received: from tyan-ft48-01.lab.bos.redhat.com (tyan-ft48-01.lab.bos.redhat.com [127.0.0.1]) by tyan-ft48-01.lab.bos.redhat.com (8.14.4/8.14.4) with ESMTP id q25BE3VT019657; Mon, 5 Mar 2012 12:14:04 +0100 Received: (from jakub@localhost) by tyan-ft48-01.lab.bos.redhat.com (8.14.4/8.14.4/Submit) id q25BE3vi019655; Mon, 5 Mar 2012 12:14:03 +0100 Date: Mon, 5 Mar 2012 12:14:03 +0100 From: Jakub Jelinek To: Richard Guenther Cc: gcc-patches@gcc.gnu.org Subject: [PATCH] cfg_layout_merge_blocks cleanup Message-ID: <20120305111403.GT18768@tyan-ft48-01.lab.bos.redhat.com> Reply-To: Jakub Jelinek MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) 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 Hi! Here is a tiny cleanup, written as part of PR52139 fix. Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2012-03-05 Jakub Jelinek * cfgrtl.c (cfg_layout_merge_blocks): Cleanup. Jakub --- gcc/cfgrtl.c.jj 2012-02-07 16:05:47.977533716 +0100 +++ gcc/cfgrtl.c 2012-02-07 17:03:52.925956927 +0100 @@ -2818,6 +2818,7 @@ static void cfg_layout_merge_blocks (basic_block a, basic_block b) { bool forwarder_p = (b->flags & BB_FORWARDER_BLOCK) != 0; + rtx insn; gcc_checking_assert (cfg_layout_can_merge_blocks_p (a, b)); @@ -2883,40 +2884,28 @@ cfg_layout_merge_blocks (basic_block a, /* In the case basic blocks are not adjacent, move them around. */ if (NEXT_INSN (BB_END (a)) != BB_HEAD (b)) { - rtx first = unlink_insn_chain (BB_HEAD (b), BB_END (b)); + insn = unlink_insn_chain (BB_HEAD (b), BB_END (b)); - emit_insn_after_noloc (first, BB_END (a), a); - /* Skip possible DELETED_LABEL insn. */ - if (!NOTE_INSN_BASIC_BLOCK_P (first)) - first = NEXT_INSN (first); - gcc_assert (NOTE_INSN_BASIC_BLOCK_P (first)); - BB_HEAD (b) = NULL; - - /* emit_insn_after_noloc doesn't call df_insn_change_bb. - We need to explicitly call. */ - update_bb_for_insn_chain (NEXT_INSN (first), - BB_END (b), - a); - - delete_insn (first); + emit_insn_after_noloc (insn, BB_END (a), a); } /* Otherwise just re-associate the instructions. */ else { - rtx insn; - - update_bb_for_insn_chain (BB_HEAD (b), BB_END (b), a); - insn = BB_HEAD (b); - /* Skip possible DELETED_LABEL insn. */ - if (!NOTE_INSN_BASIC_BLOCK_P (insn)) - insn = NEXT_INSN (insn); - gcc_assert (NOTE_INSN_BASIC_BLOCK_P (insn)); - BB_HEAD (b) = NULL; BB_END (a) = BB_END (b); - delete_insn (insn); } + /* emit_insn_after_noloc doesn't call df_insn_change_bb. + We need to explicitly call. */ + update_bb_for_insn_chain (insn, BB_END (b), a); + + /* Skip possible DELETED_LABEL insn. */ + if (!NOTE_INSN_BASIC_BLOCK_P (insn)) + insn = NEXT_INSN (insn); + gcc_assert (NOTE_INSN_BASIC_BLOCK_P (insn)); + BB_HEAD (b) = NULL; + delete_insn (insn); + df_bb_delete (b->index); /* Possible tablejumps and barriers should appear after the block. */