This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Patch] rtx_cost of SUBREG
- From: Ulrich Weigand <uweigand at de dot ibm dot com>
- To: ebotcazou at libertysurf dot fr (Eric Botcazou)
- Cc: roger at eyesopen dot com (Roger Sayle), gcc-patches at gcc dot gnu dot org, mdetting at yahoo dot com (Mark Dettinger)
- Date: Sat, 22 Jan 2005 16:31:45 +0100 (CET)
- Subject: Re: [Patch] rtx_cost of SUBREG
Eric Botcazou wrote:
> > > 2005-01-14 Mark Dettinger <dettinge@de.ibm.com>
> > >
> > > * 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
override?
Bye,
Ulrich
--
Dr. Ulrich Weigand
Linux on zSeries Development
Ulrich.Weigand@de.ibm.com