This is the mail archive of the gcc@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: Problem: delete_dead_jumptables and constant pool references


Richard Henderson wrote:
> On Mon, Aug 13, 2001 at 11:40:13PM +0200, Ulrich Weigand wrote:
> > Is this the correct approach to fix the problem?
> 
> Not quite, the label should be deleted too, but by
> turning it into a NOTE_INSN_DELETED_LABEL.  Try
> 
>   flow_delete_insn_chain (insn, NEXT_INSN (insn));
> 
> instead of the two flow_delete_insn calls.

Sorry for the late reply; I finally got around to try this out.
The patch below, implementing your suggestion, does indeed fix
the problem I'm experiencing as well.

OK to apply?

ChangeLog:

	* flow.c (delete_dead_jumptables): Delete jumptable if
	the only reference is from the literal pool.


Index: gcc/flow.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/flow.c,v
retrieving revision 1.478
diff -c -p -r1.478 flow.c
*** flow.c	2001/09/16 20:21:24	1.478
--- flow.c	2001/09/20 21:33:24
*************** delete_dead_jumptables ()
*** 795,809 ****
      {
        next = NEXT_INSN (insn);
        if (GET_CODE (insn) == CODE_LABEL
! 	  && LABEL_NUSES (insn) == 0
  	  && GET_CODE (next) == JUMP_INSN
  	  && (GET_CODE (PATTERN (next)) == ADDR_VEC
  	      || GET_CODE (PATTERN (next)) == ADDR_DIFF_VEC))
  	{
  	  if (rtl_dump_file)
  	    fprintf (rtl_dump_file, "Dead jumptable %i removed\n", INSN_UID (insn));
! 	  flow_delete_insn (NEXT_INSN (insn));
! 	  flow_delete_insn (insn);
  	  next = NEXT_INSN (next);
  	}
      }
--- 795,808 ----
      {
        next = NEXT_INSN (insn);
        if (GET_CODE (insn) == CODE_LABEL
! 	  && LABEL_NUSES (insn) == LABEL_PRESERVE_P (insn)
  	  && GET_CODE (next) == JUMP_INSN
  	  && (GET_CODE (PATTERN (next)) == ADDR_VEC
  	      || GET_CODE (PATTERN (next)) == ADDR_DIFF_VEC))
  	{
  	  if (rtl_dump_file)
  	    fprintf (rtl_dump_file, "Dead jumptable %i removed\n", INSN_UID (insn));
! 	  flow_delete_insn_chain (insn, NEXT_INSN (insn));
  	  next = NEXT_INSN (next);
  	}
      }





-- 
  Dr. Ulrich Weigand
  weigand@informatik.uni-erlangen.de


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