rtx ret_label = NULL_RTX;
basic_block nb;
edge_iterator ei;
+ bool asm_goto = false;
if (EDGE_COUNT (bb->succs) == 0)
continue;
|| e_fall->dest == EXIT_BLOCK_PTR_FOR_FN (cfun))
continue;
- /* Otherwise we'll have to use the fallthru fixup below. */
+ /* Otherwise we'll have to use the fallthru fixup below.
+ But avoid redirecting asm goto to EXIT. */
+ asm_goto = true;
}
else
{
return rather than a jump to the return block. */
rtx_insn *ret, *use;
basic_block dest;
- if (bb_is_just_return (e_fall->dest, &ret, &use)
+ if (!asm_goto
+ && bb_is_just_return (e_fall->dest, &ret, &use)
&& ((PATTERN (ret) == simple_return_rtx && targetm.have_simple_return ())
|| (PATTERN (ret) == ret_rtx && targetm.have_return ())))
{
--- /dev/null
+/* PR rtl-optimization/108263 */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+int v, *p;
+
+void
+foo (void)
+{
+ int i;
+ for (i = 0; ; i++)
+ {
+ if (v)
+ {
+ __label__ l1;
+ asm goto ("" : : : : l1);
+ l1:
+ return;
+ }
+ if (p[i])
+ break;
+ }
+ asm goto ("" : : "r" (i) : : l2);
+l2:;
+}