This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] cfg_layout_merge_blocks cleanup
- From: Richard Guenther <rguenther at suse dot de>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Mon, 5 Mar 2012 12:15:32 +0100 (CET)
- Subject: Re: [PATCH] cfg_layout_merge_blocks cleanup
- References: <20120305111403.GT18768@tyan-ft48-01.lab.bos.redhat.com>
On Mon, 5 Mar 2012, Jakub Jelinek wrote:
> Hi!
>
> Here is a tiny cleanup, written as part of PR52139 fix.
> Bootstrapped/regtested on x86_64-linux and i686-linux,
> ok for trunk?
Ok.
Thanks,
Richard.
> 2012-03-05 Jakub Jelinek <jakub@redhat.com>
>
> * cfgrtl.c (cfg_layout_merge_blocks): Cleanup.
>
> --- 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. */
>
> Jakub
>
>
--
Richard Guenther <rguenther@suse.de>
SUSE / SUSE Labs
SUSE LINUX Products GmbH - Nuernberg - AG Nuernberg - HRB 16746
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer