@@ -1293,21 +1293,21 @@ force_nonfallthru_and_redirect (edge e,
}
/* If e->src ends with asm goto, see if any of the ASM_OPERANDS_LABELs
- don't point to target label. */
+ don't point to the target or fallthru label. */
if (JUMP_P (BB_END (e->src))
&& target != EXIT_BLOCK_PTR
- && e->dest == target
&& (e->flags & EDGE_FALLTHRU)
&& (note = extract_asm_operands (PATTERN (BB_END (e->src)))))
{
int i, n = ASM_OPERANDS_LABEL_LENGTH (note);
for (i = 0; i < n; ++i)
- if (XEXP (ASM_OPERANDS_LABEL (note, i), 0) == BB_HEAD (target))
- {
+ {
+ if (XEXP (ASM_OPERANDS_LABEL (note, i), 0) == BB_HEAD (e->dest))
+ XEXP (ASM_OPERANDS_LABEL (note, i), 0) = block_label (target);
+ if (XEXP (ASM_OPERANDS_LABEL (note, i), 0) == BB_HEAD (target))
asm_goto_edge = true;
- break;
- }
+ }
}
if (EDGE_COUNT (e->src->succs) >= 2 || abnormal_edge_flags || asm_goto_edge)
@@ -0,0 +1,15 @@
+/* PR rtl-optimization/53589 */
+/* { dg-do compile } */
+
+extern void foo (void) __attribute__ ((__noreturn__));
+
+void
+bar (int x)
+{
+ if (x < 0)
+ foo ();
+ if (x == 0)
+ return;
+ __asm goto ("# %l[lab]" : : : : lab);
+lab:;
+}