Commit 91c50487 by Martin Liska Committed by Martin Liska

Remove a barrier when EDGE_CROSSING is removed (PR lto/88858).

2019-02-13  Martin Liska  <mliska@suse.cz>

	PR lto/88858
	* cfgrtl.c (remove_barriers_from_footer): New function.
	(try_redirect_by_replacing_jump): Use it.
	(cfg_layout_redirect_edge_and_branch): Likewise.

From-SVN: r268835
parent d60a02c8
2019-02-13 Martin Liska <mliska@suse.cz>
PR lto/88858
* cfgrtl.c (remove_barriers_from_footer): New function.
(try_redirect_by_replacing_jump): Use it.
(cfg_layout_redirect_edge_and_branch): Likewise.
2019-02-13 Xiong Hu Luo <luoxhu@linux.vnet.ibm.com> 2019-02-13 Xiong Hu Luo <luoxhu@linux.vnet.ibm.com>
* config/rs6000/altivec.h (vec_sbox_be, vec_cipher_be, * config/rs6000/altivec.h (vec_sbox_be, vec_cipher_be,
......
...@@ -988,6 +988,31 @@ block_label (basic_block block) ...@@ -988,6 +988,31 @@ block_label (basic_block block)
return as_a <rtx_code_label *> (BB_HEAD (block)); return as_a <rtx_code_label *> (BB_HEAD (block));
} }
/* Remove all barriers from BB_FOOTER of a BB. */
static void
remove_barriers_from_footer (basic_block bb)
{
rtx_insn *insn = BB_FOOTER (bb);
/* Remove barriers but keep jumptables. */
while (insn)
{
if (BARRIER_P (insn))
{
if (PREV_INSN (insn))
SET_NEXT_INSN (PREV_INSN (insn)) = NEXT_INSN (insn);
else
BB_FOOTER (bb) = NEXT_INSN (insn);
if (NEXT_INSN (insn))
SET_PREV_INSN (NEXT_INSN (insn)) = PREV_INSN (insn);
}
if (LABEL_P (insn))
return;
insn = NEXT_INSN (insn);
}
}
/* Attempt to perform edge redirection by replacing possibly complex jump /* Attempt to perform edge redirection by replacing possibly complex jump
instruction by unconditional jump or removing jump completely. This can instruction by unconditional jump or removing jump completely. This can
apply only if all edges now point to the same block. The parameters and apply only if all edges now point to the same block. The parameters and
...@@ -1051,26 +1076,8 @@ try_redirect_by_replacing_jump (edge e, basic_block target, bool in_cfglayout) ...@@ -1051,26 +1076,8 @@ try_redirect_by_replacing_jump (edge e, basic_block target, bool in_cfglayout)
/* Selectively unlink whole insn chain. */ /* Selectively unlink whole insn chain. */
if (in_cfglayout) if (in_cfglayout)
{ {
rtx_insn *insn = BB_FOOTER (src);
delete_insn_chain (kill_from, BB_END (src), false); delete_insn_chain (kill_from, BB_END (src), false);
remove_barriers_from_footer (src);
/* Remove barriers but keep jumptables. */
while (insn)
{
if (BARRIER_P (insn))
{
if (PREV_INSN (insn))
SET_NEXT_INSN (PREV_INSN (insn)) = NEXT_INSN (insn);
else
BB_FOOTER (src) = NEXT_INSN (insn);
if (NEXT_INSN (insn))
SET_PREV_INSN (NEXT_INSN (insn)) = PREV_INSN (insn);
}
if (LABEL_P (insn))
break;
insn = NEXT_INSN (insn);
}
} }
else else
delete_insn_chain (kill_from, PREV_INSN (BB_HEAD (target)), delete_insn_chain (kill_from, PREV_INSN (BB_HEAD (target)),
...@@ -4396,6 +4403,7 @@ cfg_layout_redirect_edge_and_branch (edge e, basic_block dest) ...@@ -4396,6 +4403,7 @@ cfg_layout_redirect_edge_and_branch (edge e, basic_block dest)
"Removing crossing jump while redirecting edge form %i to %i\n", "Removing crossing jump while redirecting edge form %i to %i\n",
e->src->index, dest->index); e->src->index, dest->index);
delete_insn (BB_END (src)); delete_insn (BB_END (src));
remove_barriers_from_footer (src);
e->flags |= EDGE_FALLTHRU; e->flags |= EDGE_FALLTHRU;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment