This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PR 31396 (suboptimal register allocation)
- From: Jan Hubicka <jh at suse dot cz>
- To: Vladimir Makarov <vmakarov at redhat dot com>
- Cc: Jan Hubicka <jh at suse dot cz>, gcc-patches at gcc dot gnu dot org
- Date: Thu, 17 Jan 2008 08:51:51 +0100
- Subject: Re: PR 31396 (suboptimal register allocation)
- References: <20080115145453.GA19896@kam.mff.cuni.cz> <478CDE7E.7090803@redhat.com>
Hi,
> Thanks for the patch. The patch is OK. You can commit it.
>
> The analogous approach is used in IRA but on the base of IRA general
> cost model.
>
> I think that factor 4 in CALLER_SAVE_PROFITABLE might be bigger than
> necessary because only store and load is necessary around the call (it
> means factor 2) and caller-saves.c frequently removes redundant
> load/store around calls when there are more one call in a basic block.
I've commited the patch. Quite interestingly tonight improvement in
SPECfp especially with FDO bigger than I've expected
http://www.suse.de/~gcctest/SPEC/CFP/sb-haydn-fdo-64-FDO/recent.html
(it might be different patch comitted today too, but I don't see obvious
candidate for it)
It seems that there is quite a bit of room for improvement here: the
heuristics is definitly overestimating cost of calls for long lived
pseudos. Did you try on IRA to take into account 2)? It looks like
load/store placement for caller save/restore is LCM problem, perhaps it
can be solved for all pseudo that might be allocated to caller saved
registers and live across call to get realistic cost estimates
beforehand?
Honza
>
> Vlad
>
> >Honza
> >
> > PR rtl-optimization/31396
> > * regstat.c (regstat_bb_compute_ri): Compute FREQ_CALLS_CROSSED.
> > * cfg.c (dump_reg_info): Print it.
> > * regs.h (struct reg_info_t): add freq_calls_crossed.
> > (REG_FREQ_CALLS_CROSSED): New macro.
> > * global.c (global_alloc): Compute freq_calls_crossed for allocno.
> > (find_reg): Update call of CALLER_SAVE_PROFITABLE.
> > * regmove.c (optimize_reg_copy_1, optimize_reg_copy_2, fixup_match_2,
> > regmove_optimize): Update call crossed frequencies.
> > * local-alloc.c (struct qty): Add freq_calls_crossed.
> > (alloc_qty): Copute freq_calls_crossed.
> > (update_equiv_regs, combine_regs): Update REG_FREQ_CALLS_CROSSED.
> > (find_free_reg): Update call of CALLER_SAVE_PROFITABLE.
> > * ra.h (struct allocno): Add freq_calls_crossed.
> >