This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch] Bail out if the same label is emitted twice
- From: Steven Bosscher <stevenb dot gcc at gmail dot com>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Sat, 14 Jul 2012 21:25:09 +0200
- Subject: [patch] Bail out if the same label is emitted twice
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;
}