diff mbox

Bail out if the same label is emitted twice

Message ID CABu31nMU2-qzoVVv=Z3xDYBR-23L5OC8szmEoQLVS2jT+5A8yw@mail.gmail.com
State New
Headers show

Commit Message

Steven Bosscher July 14, 2012, 7:25 p.m. UTC
Hello,

Just another small cleanup. This probably made sense before
function-at-a-time became the norm, 10 years ago.

Bootstrapped&tested on powerpc64-unknown-linux-gnu and x86_64-unknown-linux-gnu.
OK for trunk?

Ciao!
Steven


        * emit-rtl.c (emit_label_before): Do not allow the same label
        to be emitted twice.
        (emit_label_after): Likewise.
        (emit_label): Likewise.

Comments

Richard Biener July 16, 2012, 9:28 a.m. UTC | #1
On Sat, Jul 14, 2012 at 9:25 PM, Steven Bosscher <stevenb.gcc@gmail.com> wrote:
> Hello,
>
> Just another small cleanup. This probably made sense before
> function-at-a-time became the norm, 10 years ago.
>
> Bootstrapped&tested on powerpc64-unknown-linux-gnu and x86_64-unknown-linux-gnu.
> OK for trunk?

Ok.

Thanks,
Richard.

> Ciao!
> Steven
>
>
>         * emit-rtl.c (emit_label_before): Do not allow the same label
>         to be emitted twice.
>         (emit_label_after): Likewise.
>         (emit_label): Likewise.
>
> Index: emit-rtl.c
> ===================================================================
> --- emit-rtl.c  (revision 189482)
> +++ emit-rtl.c  (working copy)
> @@ -4221,14 +4221,9 @@ emit_barrier_before (rtx before)
>  rtx
>  emit_label_before (rtx label, rtx before)
>  {
> -  /* This can be called twice for the same label as a result of the
> -     confusion that follows a syntax error!  So make it harmless.  */
> -  if (INSN_UID (label) == 0)
> -    {
> -      INSN_UID (label) = cur_insn_uid++;
> -      add_insn_before (label, before, NULL);
> -    }
> -
> +  gcc_checking_assert (INSN_UID (label) == 0);
> +  INSN_UID (label) = cur_insn_uid++;
> +  add_insn_before (label, before, NULL);
>    return label;
>  }
>
> @@ -4387,15 +4382,9 @@ emit_barrier_after (rtx after)
>  rtx
>  emit_label_after (rtx label, rtx after)
>  {
> -  /* This can be called twice for the same label
> -     as a result of the confusion that follows a syntax error!
> -     So make it harmless.  */
> -  if (INSN_UID (label) == 0)
> -    {
> -      INSN_UID (label) = cur_insn_uid++;
> -      add_insn_after (label, after, NULL);
> -    }
> -
> +  gcc_checking_assert (INSN_UID (label) == 0);
> +  INSN_UID (label) = cur_insn_uid++;
> +  add_insn_after (label, after, NULL);
>    return label;
>  }
>
> @@ -4811,14 +4800,9 @@ emit_call_insn (rtx x)
>  rtx
>  emit_label (rtx label)
>  {
> -  /* This can be called twice for the same label
> -     as a result of the confusion that follows a syntax error!
> -     So make it harmless.  */
> -  if (INSN_UID (label) == 0)
> -    {
> -      INSN_UID (label) = cur_insn_uid++;
> -      add_insn (label);
> -    }
> +  gcc_checking_assert (INSN_UID (label) == 0);
> +  INSN_UID (label) = cur_insn_uid++;
> +  add_insn (label);
>    return label;
>  }
diff mbox

Patch

Index: emit-rtl.c
===================================================================
--- emit-rtl.c  (revision 189482)
+++ emit-rtl.c  (working copy)
@@ -4221,14 +4221,9 @@  emit_barrier_before (rtx before)
 rtx
 emit_label_before (rtx label, rtx before)
 {
-  /* This can be called twice for the same label as a result of the
-     confusion that follows a syntax error!  So make it harmless.  */
-  if (INSN_UID (label) == 0)
-    {
-      INSN_UID (label) = cur_insn_uid++;
-      add_insn_before (label, before, NULL);
-    }
-
+  gcc_checking_assert (INSN_UID (label) == 0);
+  INSN_UID (label) = cur_insn_uid++;
+  add_insn_before (label, before, NULL);
   return label;
 }

@@ -4387,15 +4382,9 @@  emit_barrier_after (rtx after)
 rtx
 emit_label_after (rtx label, rtx after)
 {
-  /* This can be called twice for the same label
-     as a result of the confusion that follows a syntax error!
-     So make it harmless.  */
-  if (INSN_UID (label) == 0)
-    {
-      INSN_UID (label) = cur_insn_uid++;
-      add_insn_after (label, after, NULL);
-    }
-
+  gcc_checking_assert (INSN_UID (label) == 0);
+  INSN_UID (label) = cur_insn_uid++;
+  add_insn_after (label, after, NULL);
   return label;
 }

@@ -4811,14 +4800,9 @@  emit_call_insn (rtx x)
 rtx
 emit_label (rtx label)
 {
-  /* This can be called twice for the same label
-     as a result of the confusion that follows a syntax error!
-     So make it harmless.  */
-  if (INSN_UID (label) == 0)
-    {
-      INSN_UID (label) = cur_insn_uid++;
-      add_insn (label);
-    }
+  gcc_checking_assert (INSN_UID (label) == 0);
+  INSN_UID (label) = cur_insn_uid++;
+  add_insn (label);
   return label;
 }