more on 921117-1 test failure with egcs 970828 on mips-sgi-irix5.3 (looks like CSE)

Jim Wilson wilson@chestnut.cygnus.com
Mon Sep 1 16:43:00 GMT 1997


This is a problem with the new alias analysis code.

It used to be that BLKmode MEMs always conflicted with all other MEMs, and
hence we could never end up with an equivalence between two BLKmode MEMs.
Now, with the new aliasing code, BLKmode MEMs only conflict with a subset
of other MEMs, and hence it is now possible to get an equivalence between
two BLKmode MEMs.

In this particular case, we have a memcpy from (symbol_ref:SI ("*$LC0")) to
(symbol_ref:SI ("cell")), and then a memcpy from (symbol_ref:SI ("cell")) to
a stack slot.  The first one sets up an equivalence between the two addresses,
which obviously don't conflict, and then cse thinks the second memcpy can just
use the first address because of the equivalence.  However, the first mempcy
is for 11 bytes, and the second memcpy is for 16 bytes, so we end up with 5
bytes of junk in the stack slot if we use the first address.

This can be fixed by not allowing equivalencies to be set up for BLKmode
values.  Since we do not know the size of a BLKmode references, we can never
tell if two identical BLKmode MEMs reference exactly the same bytes.

Alternatively, we could allow the equivalences to be set up, but then
modify exp_equiv_p to reject them, but I don't see any advantaged to that.

Mon Sep  1 16:25:34 1997  Jim Wilson  <wilson@cygnus.com>

	* cse.c (cse_insn): Don't record BLKmode values.

Index: cse.c
===================================================================
RCS file: /cvs/cvsfiles/egcs/gcc/cse.c,v
retrieving revision 1.2
diff -p -r1.2 cse.c
*** cse.c	1997/08/11 20:07:13	1.2
--- cse.c	1997/09/01 23:25:10
*************** cse_insn (insn, in_libcall_block)
*** 7297,7302 ****
--- 7297,7306 ----
  	if ((flag_float_store
  	     && GET_CODE (dest) == MEM
  	     && FLOAT_MODE_P (GET_MODE (dest)))
+ 	    /* Don't record BLKmode values, because we don't know the
+ 	       size of it, and can't be sure that other BLKmode values
+ 	       have the same or smaller size.  */
+ 	    || GET_MODE (dest) == BLKmode
  	    /* Don't record values of destinations set inside a libcall block
  	       since we might delete the libcall.  Things should have been set
  	       up so we won't want to reuse such a value, but we play it safe



More information about the Gcc-bugs mailing list