gcc-2.95.3, but not gcc-2.95.2, requires gas on

John David Anglin dave@hiauly1.hia.nrc.ca
Fri Jan 26 11:16:00 GMT 2001


>   > The problem is that we have an apparently unused exception handler which is
>   > optimized out during flow, but a reference to its label survives in a
>   > constant pool.  It's a bit odd that the label got deleted, since the load
>   > from the constant pool has a REG_LABEL note and you'd think flow would coun
>   > that as a use.
> Definitely odd.  Seems to me that the use in the constant pool should have
> counted for the purposes of LABEL_NUSES.

I don't know if this is relevant but this patch was added to the mainline
to correct a label dletion problem.

Dave
-- 
J. David Anglin                                  dave.anglin@nrc.ca
National Research Council of Canada              (613) 990-0752 (FAX: 952-6605)

2000-12-14  John David Anglin  <dave@hiauly1.hia.nrc.ca>

	* loop.c (add_label_notes): Increment the label usage count when
	a note is added to an insn which refers to a CODE_LABEL.
	* gcse.c (add_label_notes): Likewise.

--- loop.c.orig	Thu Nov 30 12:22:29 2000
+++ loop.c	Fri Dec 15 17:25:46 2000
@@ -1589,7 +1589,8 @@
 }
 
 /* If X contains any LABEL_REF's, add REG_LABEL notes for them to all
-  insns in INSNS which use the reference.  */
+   insns in INSNS which use the reference.  LABEL_NUSES for CODE_LABEL
+   references is incremented once for each added note. */
 
 static void
 add_label_notes (x, insns)
@@ -1610,8 +1611,12 @@
          mark_jump_label for additional information).  */
       for (insn = insns; insn; insn = NEXT_INSN (insn))
 	if (reg_mentioned_p (XEXP (x, 0), insn))
-	  REG_NOTES (insn) = gen_rtx_EXPR_LIST (REG_LABEL, XEXP (x, 0),
-						REG_NOTES (insn));
+	  {
+	    REG_NOTES (insn) = gen_rtx_EXPR_LIST (REG_LABEL, XEXP (x, 0),
+						  REG_NOTES (insn));
+	    if (LABEL_P (XEXP (x, 0)))
+	      LABEL_NUSES (XEXP (x, 0))++;
+	  }
     }
 
   fmt = GET_RTX_FORMAT (code);
--- gcse.c.orig	Wed Dec  6 16:16:30 2000
+++ gcse.c	Fri Dec 15 17:23:06 2000
@@ -4839,8 +4839,9 @@
 }
 
 /* If X contains any LABEL_REF's, add REG_LABEL notes for them to INSN.
-   We have to add REG_LABEL notes, because the following loop optimization
-   pass requires them.  */
+   If notes are added to an insn which references a CODE_LABEL, the
+   LABEL_NUSES count is incremented.  We have to add REG_LABEL notes,
+   because the following loop optimization pass requires them.  */
 
 /* ??? This is very similar to the loop.c add_label_notes function.  We
    could probably share code here.  */
@@ -4868,6 +4869,8 @@
 
       REG_NOTES (insn) = gen_rtx_EXPR_LIST (REG_LABEL, XEXP (x, 0),
 					    REG_NOTES (insn));
+      if (LABEL_P (XEXP (x, 0)))
+        LABEL_NUSES (XEXP (x, 0))++;
       return;
     }
 


More information about the Gcc-bugs mailing list