This is the mail archive of the 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] rtx_cost of SUBREG

Eric Botcazou wrote:

> > > 2005-01-14  Mark Dettinger  <>
> > >
> > >         * rtlanal.c (rtx_cost): Assign cost of 0 to a SUBREG
> > >           when modes are tieable.
> >
> > This looks reasonable to me.  If nobody objects in the next day
> > or two, feel free to go ahead and commit this to mainline.
> May I ask you on which grounds this patch was accepted?  Does it fix a bug?

It fixes a performance regression.  Now that combine uses rtx_cost to decide
whether or not to actually perform a possible transformation, the incorrectly
inflated cost of SUBREGs would prevent perfectly good combinations from being
done.  We have seen some cases on s390 ...

> I can tell you that it breaks bootstrap on SPARC 64-bit (stack overflow in the 
> combiner).  Granted, the real problem is elsewhere (bad interaction between 
> apply_distributive_law and simplify_associative_operation, I can give the gory 
> details if you want) but I think tweaking the generic cost function at the 
> very end of stage3 is dangerous.  I'm seeing this sort of things in the 
> combiner now:
> (ior:DI (and:DI (and:DI (ior:DI (ior:DI (and:DI (subreg:DI (reg:SI 159) 0)
>                         (const_int 4 [0x4]))
>                     (subreg:DI (reg:SI 150) 0))
>                 (subreg:DI (reg:SI 152) 0))
>             (subreg:DI (reg:SI 159) 0))
>         (const_int 4 [0x4]))
>     (and:DI (ior:DI (ior:DI (and:DI (subreg:DI (reg:SI 159) 0)
>                     (const_int 4 [0x4]))
>                 (subreg:DI (reg:SI 150) 0))
>             (subreg:DI (reg:SI 152) 0))
>         (const_int 1 [0x1])))

I'm not sure why this is a problem; I guess it should be simplified further?

> Please revert the patch.

Would you also object to a patch that keeps the rtx_cost default for SUBREG
as it was before, but then gives the back end cost function the chance to


  Dr. Ulrich Weigand
  Linux on zSeries Development

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