This is the mail archive of the gcc@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: CPROP and spec2000 slowdown in mid february


>     Problem is that try_replace_reg believes that it did the replacement,
>     but due to missing bits in simplify_replace_rtx and forgetting about
>     set destinations it don't.
> 
> Ah!
Hi,
May I point your attention to the patch attached bellow? While it was originally
meant as simple hack around, it seems to me that it does exactly what we want.
The instruction gets simplified if it is source set, but the occurences in mems
inside stores and other expressionse are not forgotten otherwise.

I would like to see this in before we get some more beautifull code for making
such substitutions, as we will se how much improvements did your code bring.
Honza


Hi
try_replace_reg often just bails out, being satisfied that it suceeded
simplification and replacement in source of set. Actually this makes
him to miss many cases, where the register in question appears in
MEM of destination on REG_EQUAL note.

Note that I am not happy with current code, so take this patch as more
or less temporary.  I will send my ideas to the list later separately.

Fri Apr 27 13:35:00 CEST 2001  Jan Hubicka  <jh@suse.cz>

	* gcse.c (try_replace_reg): Attempt to globally replace register even if simplification
	succeded.

Index: gcc/gcse.c
===================================================================
RCS file: /home/cvs/Repository/gcc/gcc/gcse.c,v
retrieving revision 1.9
diff -c -3 -p -r1.9 gcse.c
*** gcc/gcse.c	2001/03/26 15:37:28	1.9
--- gcc/gcse.c	2001/04/27 10:20:51
*************** try_replace_reg (from, to, insn)
*** 3653,3674 ****
      {
        src = simplify_replace_rtx (SET_SRC (set), from, to);
  
!       /* Try this two ways: first just replace SET_SRC.  If that doesn't
! 	 work and this is a PARALLEL, try to replace the whole pattern
! 	 with a new SET.  */
!       if (validate_change (insn, &SET_SRC (set), src, 0))
! 	success = 1;
!       else if (GET_CODE (PATTERN (insn)) == PARALLEL
! 	       && validate_change (insn, &PATTERN (insn),
! 				   gen_rtx_SET (VOIDmode, SET_DEST (set),
! 						src),
! 				   0))
! 	success = 1;
      }
  
!   /* Otherwise, try to do a global replacement within the insn.  */
!   if (!success)
!     success = validate_replace_src (from, to, insn);
  
    /* If we've failed to do replacement, have a single SET, and don't already
       have a note, add a REG_EQUAL note to not lose information.  */
--- 3653,3678 ----
      {
        src = simplify_replace_rtx (SET_SRC (set), from, to);
  
!       if (!rtx_equal_p (SET_SRC (set), src))
! 	{
! 	  /* Try this two ways: first just replace SET_SRC.  If that doesn't
! 	     work and this is a PARALLEL, try to replace the whole pattern
! 	     with a new SET.  */
! 	  if (validate_change (insn, &SET_SRC (set), src, 0))
! 	    success = 1;
! 	  else if (GET_CODE (PATTERN (insn)) == PARALLEL
! 		   && validate_change (insn, &PATTERN (insn),
! 				       gen_rtx_SET (VOIDmode, SET_DEST (set),
! 						    src),
! 				       0))
! 	    success = 1;
! 	}
      }
  
!   /* Do global replacement in an insn.  Even if we did suceeded with previous
!      simplification, the register may be contained in memory references of
!      set destinations or notes.  */
!   success |= validate_replace_src (from, to, insn);
  
    /* If we've failed to do replacement, have a single SET, and don't already
       have a note, add a REG_EQUAL note to not lose information.  */


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