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 for PR16967


On Tuesday 10 August 2004 21:58, Steven Bosscher wrote:
> On Tuesday 10 August 2004 21:09, Roger Sayle wrote:
> > On Tue, 10 Aug 2004, Steven Bosscher wrote:
> > > 	PR rtl-optimization/16967
> > > 	* gcse.c (want_to_gcse_p): Don't want to GCSE a plain SYMBOL_REF.
> >
> > This is Ok for mainline.
>
> It appears that we need this not only for SYMBOL_REF but
> also for CONST:
>
> Index: gcse.c
> ===================================================================
> RCS file: /cvs/gcc/gcc/gcc/gcse.c,v
> retrieving revision 1.309
> diff -c -3 -p -r1.309 gcse.c
> *** gcse.c      9 Aug 2004 16:58:42 -0000       1.309
> --- gcse.c      10 Aug 2004 19:55:38 -0000
> *************** want_to_gcse_p (rtx x)
> *** 1214,1219 ****
> --- 1214,1221 ----
>       {
>       case REG:
>       case SUBREG:
> +     case SYMBOL_REF:
> +     case CONST:
>       case CONST_INT:
>       case CONST_DOUBLE:
>       case CONST_VECTOR:
>
> I have no idea what the effect of this is on either compil
> time or quality of the generated code.  I suggest I look
> into this a bit more and see what the effect of the patch
> is (or if someone can make an educated guess, be my guest ;-)

In fact LABEL_REFs too.  Fun.  I think I'll see what the effect
is of the following patch :-/

Index: gcse.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/gcse.c,v
retrieving revision 1.309
diff -c -3 -p -r1.309 gcse.c
*** gcse.c      9 Aug 2004 16:58:42 -0000       1.309
--- gcse.c      10 Aug 2004 20:03:48 -0000
*************** static basic_block current_bb;
*** 1210,1228 ****
  static int
  want_to_gcse_p (rtx x)
  {
!   switch (GET_CODE (x))
!     {
!     case REG:
!     case SUBREG:
!     case CONST_INT:
!     case CONST_DOUBLE:
!     case CONST_VECTOR:
!     case CALL:
!       return 0;

!     default:
!       return can_assign_to_reg_p (x);
!     }
  }

  /* Used internally by can_assign_to_reg_p.  */
--- 1210,1230 ----
  static int
  want_to_gcse_p (rtx x)
  {
!   RTX_CODE code = GET_CODE (x);

!   /* We don't want to GCSE (set (reg1) (reg2)) or subregs.  */
!   if (code == REG || code == SUBREG)
!     return 0;
!
!   /* Constants are candidates for constant propagation.  PRE GCSE
!      would (ehm...) un-constant-propagate them, so we don't want
!      to consider them for GCSE.  */
!   else if (CONSTANT_P (x))
!     return 0;
!
!   else
!     /* We want to GCSE X if it can be assigned to a pseudo register.  */
!     return can_assign_to_reg_p (x);
  }

  /* Used internally by can_assign_to_reg_p.  */


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