[RFC] Cse reducing performance of register allocation with -O2

Jeff Law law@redhat.com
Wed Oct 14 15:42:00 GMT 2015


On 10/13/2015 03:03 PM, Vladimir Makarov wrote:

>>
> I checked my article
>
> ftp://ftp.uvsq.fr/pub/gcc/summit/2004/Fighting%20Register%20Pressure.pdf
>
> and GVN gave mostly 0.2% on eon only.  The current environment is quite
> different (IRA, LRA) so the results might be different too.
Yea, but if anything I'd expect it's even less important now.

>
> Also as I remember I implemented GVN only for pseudos.
>
> LRA also checks values too but again only for reload and original pseudos.
>
> It is a known problem.  I saw many times when optimizations propagate
> hard registers and it is truly hurts RA.  I guess such practice should
> be discouraged.  RA can perfectly remove copy between hard reg and the
> pseudo itself as in the example above by assigning the same hard reg to
> the pseudo.
Interestingly enough if you go back far enough, the costing model was 
supposed to prefer fixed hard regs, pseudos, then non-fixed hard 
registers.  That came from CHEAP_REGNO.

At some point that ordering got lost and we have:

#define CHEAP_REGNO(N)                                                  \
   (REGNO_PTR_FRAME_P (N)                                                \
    || (HARD_REGISTER_NUM_P (N)                                          \
        && FIXED_REGNO_P (N) && REGNO_REG_CLASS (N) != NO_REGS))


Which would appear to make pseudos & non-fixed hard registers be same 
WRT CHEAP_REGNO -- punting to rtx_cost for both, presumably.

Jeff



More information about the Gcc mailing list