mem sharing fix [Re: Your flow.c change on 4/8]

Richard Henderson rth@cygnus.com
Thu Apr 13 15:31:00 GMT 2000


On Thu, Apr 13, 2000 at 04:28:29PM +0100, Richard Earnshaw wrote:
> Test case appended below.  Failure occurs with arm-semi-aout (and other 
> arm targets) with compiler flags "-O2 -g"

This seems to work.  I'm not familiar with what "normal" ARM
testsuite faliures should be.


r~


	* flow.c (find_auto_inc): Don't autoinc eliminable registers.
	If the original source is dead in the incr insn, it's dead now.

Index: flow.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/flow.c,v
retrieving revision 1.251
diff -c -p -d -r1.251 flow.c
*** flow.c	2000/04/12 01:38:15	1.251
--- flow.c	2000/04/13 22:28:27
*************** find_auto_inc (pbi, x, insn)
*** 4309,4315 ****
  				    ? (offset ? PRE_INC : POST_INC)
  				    : (offset ? PRE_DEC : POST_DEC));
  
! 	  if (dead_or_set_p (incr, addr))
  	    {
  	      /* This is the simple case.  Try to make the auto-inc.  If
  		 we can't, we are done.  Otherwise, we will do any
--- 4309,4318 ----
  				    ? (offset ? PRE_INC : POST_INC)
  				    : (offset ? PRE_DEC : POST_DEC));
  
! 	  if (dead_or_set_p (incr, addr)
! 	      /* Mustn't autoinc an eliminable register.  */
! 	      && (regno >= FIRST_PSEUDO_REGISTER
! 	          || ! TEST_HARD_REG_BIT (elim_reg_set, regno)))
  	    {
  	      /* This is the simple case.  Try to make the auto-inc.  If
  		 we can't, we are done.  Otherwise, we will do any
*************** find_auto_inc (pbi, x, insn)
*** 4410,4415 ****
--- 4413,4423 ----
  	     register.  */
  	  if (SET_DEST (set) == addr)
  	    {
+ 	      /* If the original source was dead, it's dead now.  */
+ 	      rtx note = find_reg_note (incr, REG_DEAD, NULL_RTX);
+ 	      if (note && XEXP (note, 0) != addr)
+ 		SET_REGNO_REG_SET (pbi->new_dead, REGNO (XEXP (note, 0)));
+ 	      
  	      PUT_CODE (incr, NOTE);
  	      NOTE_LINE_NUMBER (incr) = NOTE_INSN_DELETED;
  	      NOTE_SOURCE_FILE (incr) = 0;


More information about the Gcc-patches mailing list