public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [patch] Bail out if the same label is emitted twice
@ 2012-07-14 19:25 Steven Bosscher
  2012-07-16  9:28 ` Richard Guenther
  0 siblings, 1 reply; 2+ messages in thread
From: Steven Bosscher @ 2012-07-14 19:25 UTC (permalink / raw)
  To: GCC Patches

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.

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;
 }

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [patch] Bail out if the same label is emitted twice
  2012-07-14 19:25 [patch] Bail out if the same label is emitted twice Steven Bosscher
@ 2012-07-16  9:28 ` Richard Guenther
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Guenther @ 2012-07-16  9:28 UTC (permalink / raw)
  To: Steven Bosscher; +Cc: GCC Patches

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;
>  }

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-07-16  9:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-14 19:25 [patch] Bail out if the same label is emitted twice Steven Bosscher
2012-07-16  9:28 ` Richard Guenther

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).