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: PATCH for CSE


>>>>> "Jeffrey" == Jeffrey A Law <law@hurl.cygnus.com> writes:

    Jeffrey> I added it to the testsuite last night :-)
    Jeffrey> execute/980701-1.c

Jeff --

  Here's a patch for this bug.  With this patch, I renew my petition
:-) for my earlier CSE_ADDRESS_COST patch to favor the use of
ADDRESSOFs.

  Thanks,

-- 
Mark Mitchell 			mark@markmitchell.com
Mark Mitchell Consulting	http://www.markmitchell.com

Thu Jul  2 12:35:50 1998  Mark Mitchell  <mark@markmitchell.com>

	* cse.c (cse_insn): When SETting (MEM (ADDRESSOF (X))) to Y,
	don't claim that the former is equivalent to the latter.

Index: cse.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cse.c,v
retrieving revision 1.38
diff -c -p -r1.38 cse.c
*** cse.c	1998/07/01 05:10:47	1.38
--- cse.c	1998/07/02 19:33:07
*************** cse_insn (insn, in_libcall_block)
*** 7405,7410 ****
--- 7417,7423 ----
      if (sets[i].rtl)
        {
  	register rtx dest = SET_DEST (sets[i].rtl);
+ 	rtx inner_dest = sets[i].inner_dest;
  	register struct table_elt *elt;
  
  	/* Don't record value if we are not supposed to risk allocating
*************** cse_insn (insn, in_libcall_block)
*** 7452,7460 ****
  	      rehash_using_reg (dest);
  	      sets[i].dest_hash = HASH (dest, GET_MODE (dest));
  	    }
  
- 	elt = insert (dest, sets[i].src_elt,
- 		      sets[i].dest_hash, GET_MODE (dest));
  	elt->in_memory = (GET_CODE (sets[i].inner_dest) == MEM
  			  && (! RTX_UNCHANGING_P (sets[i].inner_dest)
  			      || FIXED_BASE_PLUS_P (XEXP (sets[i].inner_dest,
--- 7465,7483 ----
  	      rehash_using_reg (dest);
  	      sets[i].dest_hash = HASH (dest, GET_MODE (dest));
  	    }
+ 
+ 	if (GET_CODE (inner_dest) == MEM
+ 	    && GET_CODE (XEXP (inner_dest, 0)) == ADDRESSOF)
+ 	  /* Given (SET (MEM (ADDRESSOF (X))) Y) we don't want to say
+ 	     that (MEM (ADDRESSOF (X))) is equivalent to Y. 
+ 	     Consider the case in which the address of the MEM is
+ 	     passed to a function, which alters the MEM.  Then, if we
+ 	     later use Y instead of the MEM we'll miss the update.  */
+ 	  elt = insert (dest, 0, sets[i].dest_hash, GET_MODE (dest));
+ 	else
+ 	  elt = insert (dest, sets[i].src_elt,
+ 			sets[i].dest_hash, GET_MODE (dest));
  
  	elt->in_memory = (GET_CODE (sets[i].inner_dest) == MEM
  			  && (! RTX_UNCHANGING_P (sets[i].inner_dest)
  			      || FIXED_BASE_PLUS_P (XEXP (sets[i].inner_dest,


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