Loop patch update (Was: Re: Autoincrement examples)

Joern Rennecke amylaar@cygnus.co.uk
Fri Dec 31 23:54:00 GMT 1999


When I tried the c4x compiler built with my almagamated patches on a
combine.i from it own build (x86 hosted), I get a SEGV.  I eventally tracked
it down to the DECL_RTL of uid_cuid being clobbered by a loop transformation.
On the c4x, (mem/f:QI (symbol_ref:QI ("uid_cuid")) can be shared.

*** loop.c-19991221	Tue Dec 21 22:49:24 1999
--- loop.c	Wed Dec 22 00:46:12 1999
*************** general_induction_var (x, src_reg, add_v
*** 6421,6428 ****
--- 6421,6437 ----
  #if 0 /* Invariants are useful to derive other givs from.  */
    /* If this is an invariant, forget it, it isn't a giv.  */
    if (invariant_p (x) == 1)
      return 0;
+ #else
+   /* If this is an address, we couldn't derive other givs from it, so ignore
+      it if it's invariant.
+      If we recorded these as givs, we could generate incorrect code and/or
+      corrupt the DECL_RTL of global variables on some targets when the
+      address is substituted with a pseudo, since MEMs with a
+      CONSTANT_ADDRESS_P address can be shared.  */
+   if (is_addr && invariant_p (x) == 1)
+     return 0;
  #endif
  
    /* See if the expression could be a giv and get its form.
       Mark our place on the obstack in case we don't find a giv.  */



More information about the Gcc mailing list