This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: disappearing labels fix


  In message <5.1.0.14.2.20010514152836.03a85368@mail.lauterbach.com>you write:
  > Jeff, I just confirmed this. Reverting your last patch to cse.c (which 
  > fixes the PPC problems with jumptable labels) makes this testcase pass 
  > again on x86-linux-gnu with RTL checking enabled.
This should fix the RTL checking abort; it also adds some additional
sanity checking to the compiler.

Bootstrapped on the PA, x86 & PPC.  Installed into the mainline sources
and on the branch.


	* flow.c (life_analysis): After life analysis is complete, do
	an optional scan over insns looking for REG_LABEL notes that
	reference a deleted label.
	(propagate_block_delete_insn): Verify INOTE is a CODE_LABEL
	before peeking at LABEL_NUSES.
 
Index: flow.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/flow.c,v
retrieving revision 1.374.2.11
diff -c -3 -p -r1.374.2.11 flow.c
*** flow.c	2001/05/13 07:09:54	1.374.2.11
--- flow.c	2001/05/16 04:08:16
*************** life_analysis (f, file, flags)
*** 2726,2731 ****
--- 2726,2746 ----
      dump_flow_info (file);
  
    free_basic_block_vars (1);
+ 
+ #ifdef ENABLE_CHECKING
+   {
+     rtx insn;
+ 
+     /* Search for any REG_LABEL notes whih reference deleted labels.  */
+     for (insn = get_insns (); insn; insn = NEXT_INSN (insn))
+       {
+ 	rtx inote = find_reg_note (insn, REG_LABEL, NULL_RTX);
+ 
+ 	if (inote && GET_CODE (inote) == NOTE_INSN_DELETED_LABEL)
+ 	  abort ();
+       }
+   }
+ #endif
  }
  
  /* A subroutine of verify_wide_reg, called through for_each_rtx.
*************** propagate_block_delete_insn (bb, insn)
*** 3526,3534 ****
    /* If the insn referred to a label, and that label was attached to
       an ADDR_VEC, it's safe to delete the ADDR_VEC.  In fact, it's
       pretty much mandatory to delete it, because the ADDR_VEC may be
!      referencing labels that no longer exist.  */
  
!   if (inote)
      {
        rtx label = XEXP (inote, 0);
        rtx next;
--- 3541,3558 ----
    /* If the insn referred to a label, and that label was attached to
       an ADDR_VEC, it's safe to delete the ADDR_VEC.  In fact, it's
       pretty much mandatory to delete it, because the ADDR_VEC may be
!      referencing labels that no longer exist.
! 
!      INSN may reference a deleted label, particularly when a jump
!      table has been optimized into a direct jump.  There's no
!      real good way to fix up the reference to the deleted label
!      when the label is deleted, so we just allow it here.
! 
!      After dead code elimination is complete, we do search for
!      any REG_LABEL notes which reference deleted labels as a
!      sanity check.  */
  
!   if (inote && GET_CODE (inote) == CODE_LABEL)
      {
        rtx label = XEXP (inote, 0);
        rtx next;




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]