re PR rtl-optimization/87475 (ICE in patch_jump_insn, at cfgrtl.c:1275)

PR rtl-optimization/87475
	* cfgrtl.c (patch_jump_insn): Allow redirection failure for
	CROSSING_JUMP_P insns.
	(cfg_layout_redirect_edge_and_branch): Don't ICE if ret is NULL.

	* g++.dg/opt/pr87475.C: New test.

From-SVN: r266219
This commit is contained in:
Jakub Jelinek 2018-11-16 17:43:49 +01:00 committed by Jakub Jelinek
parent b41835733b
commit a09ad34709
4 changed files with 26 additions and 2 deletions

View File

@ -1,3 +1,10 @@
2018-11-16 Jakub Jelinek <jakub@redhat.com>
PR rtl-optimization/87475
* cfgrtl.c (patch_jump_insn): Allow redirection failure for
CROSSING_JUMP_P insns.
(cfg_layout_redirect_edge_and_branch): Don't ICE if ret is NULL.
2018-11-16 Uros Bizjak <ubizjak@gmail.com> 2018-11-16 Uros Bizjak <ubizjak@gmail.com>
PR target/88051 PR target/88051

View File

@ -1268,11 +1268,13 @@ patch_jump_insn (rtx_insn *insn, rtx_insn *old_label, basic_block new_bb)
/* If the substitution doesn't succeed, die. This can happen /* If the substitution doesn't succeed, die. This can happen
if the back end emitted unrecognizable instructions or if if the back end emitted unrecognizable instructions or if
target is exit block on some arches. */ target is exit block on some arches. Or for crossing
jumps. */
if (!redirect_jump (as_a <rtx_jump_insn *> (insn), if (!redirect_jump (as_a <rtx_jump_insn *> (insn),
block_label (new_bb), 0)) block_label (new_bb), 0))
{ {
gcc_assert (new_bb == EXIT_BLOCK_PTR_FOR_FN (cfun)); gcc_assert (new_bb == EXIT_BLOCK_PTR_FOR_FN (cfun)
|| CROSSING_JUMP_P (insn));
return false; return false;
} }
} }
@ -4460,6 +4462,9 @@ cfg_layout_redirect_edge_and_branch (edge e, basic_block dest)
else else
ret = redirect_branch_edge (e, dest); ret = redirect_branch_edge (e, dest);
if (!ret)
return NULL;
fixup_partition_crossing (ret); fixup_partition_crossing (ret);
/* We don't want simplejumps in the insn stream during cfglayout. */ /* We don't want simplejumps in the insn stream during cfglayout. */
gcc_assert (!simplejump_p (BB_END (src)) || CROSSING_JUMP_P (BB_END (src))); gcc_assert (!simplejump_p (BB_END (src)) || CROSSING_JUMP_P (BB_END (src)));

View File

@ -1,3 +1,8 @@
2018-11-16 Jakub Jelinek <jakub@redhat.com>
PR rtl-optimization/87475
* g++.dg/opt/pr87475.C: New test.
2018-11-16 Matthew Malcomson <matthew.malcomson@arm.com> 2018-11-16 Matthew Malcomson <matthew.malcomson@arm.com>
* gcc.c-torture/execute/printf-2.c: Skip on wrapped boards. * gcc.c-torture/execute/printf-2.c: Skip on wrapped boards.

View File

@ -0,0 +1,7 @@
// PR rtl-optimization/87475
// { dg-do compile { target freorder } }
// { dg-options "-O2 -freorder-blocks-and-partition -fmodulo-sched" }
struct A { A (); ~A (); };
int foo (A, A);
void bar (bool x) { x ? foo (A (), A ()) : 0; }