summaryrefslogtreecommitdiff
path: root/gcc/cfgrtl.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2018-11-16 17:43:49 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2018-11-16 17:43:49 +0100
commita09ad34709696a3d02ae588e7a595fd379b885b0 (patch)
tree6dc7bca638b39ef4d7674face7c249f65785cde0 /gcc/cfgrtl.c
parentb41835733bc337580a0de6b8ba5de4b00d391fc6 (diff)
downloadgcc-a09ad34709696a3d02ae588e7a595fd379b885b0.tar.gz
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
Diffstat (limited to 'gcc/cfgrtl.c')
-rw-r--r--gcc/cfgrtl.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c
index 3d4a114cbbb..411a0245f54 100644
--- a/gcc/cfgrtl.c
+++ b/gcc/cfgrtl.c
@@ -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 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),
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;
}
}
@@ -4460,6 +4462,9 @@ cfg_layout_redirect_edge_and_branch (edge e, basic_block dest)
else
ret = redirect_branch_edge (e, dest);
+ if (!ret)
+ return NULL;
+
fixup_partition_crossing (ret);
/* We don't want simplejumps in the insn stream during cfglayout. */
gcc_assert (!simplejump_p (BB_END (src)) || CROSSING_JUMP_P (BB_END (src)));