+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>
PR target/88051
/* 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;
}
}
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)));
+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>
* gcc.c-torture/execute/printf-2.c: Skip on wrapped boards.
--- /dev/null
+// 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; }