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]
Other format: [Raw text]

Re: [PATCH] fix prefetch optimization in loop.c


> On Tue, Jan 22, 2002 at 01:07:38PM +0100, Jan Hubicka wrote:
> > It handles this in multiple transformations - first it elliminates
> > const, then changes constant to 0 and then elliminates plus.
> 
> Leaving (const (symbol_ref)) instead of just (symbol_ref).
> Not good.
It does not leave the CONST in the chain, it just patches it out first.
But here is patch that handles the (CONST (PLUS (SYMBOL) (CONST_INT)))
as special case and I believe it is good enought to handle everythig
and easier to understand.

Honza

Fri Jan 25 21:01:57 CET 2002  Jan Hubicka  <jh@suse.cz>
	* loop.c (remove_constant_addition): Fix RTL sharing problem
	in handling of CONST.
Index: loop.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/loop.c,v
retrieving revision 1.366.2.6
diff -c -3 -p -r1.366.2.6 loop.c
*** loop.c	2002/01/24 16:01:40	1.366.2.6
--- loop.c	2002/01/25 20:00:56
*************** remove_constant_addition (x)
*** 3681,3687 ****
    rtx exp = *x;
  
    if (GET_CODE (exp) == CONST)
!     exp = XEXP (exp, 0);
    if (GET_CODE (exp) == CONST_INT)
      {
        addval = INTVAL (exp);
--- 3681,3694 ----
    rtx exp = *x;
  
    if (GET_CODE (exp) == CONST)
!     {
!       if (GET_CODE (XEXP (exp, 0)) == PLUS
! 	  && GET_CODE (XEXP (XEXP (exp, 0), 0)) == SYMBOL_REF
! 	  && GET_CODE (XEXP (XEXP (exp, 0), 1)) == CONST_INT)
! 	return XEXP (XEXP (exp, 0), 0);
!       /* Avoid clobbering of shared CONST expression.  */
!       return exp;
!     }
    if (GET_CODE (exp) == CONST_INT)
      {
        addval = INTVAL (exp);


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