Commit Message

This patch updates the handling of temporary registers in postreload.c
to avoid very long build times in certain files.
By creating new registers instead of updating one existing one using
SET_REGNO it avoids going through the scan df structure.
Im new to gcc RTL and appreciate any feedback.
In the (inspired from real code) attached source, the time
for "reload CSE regs" went down from 20 usr seconds to less than 1.
2010-07-30 Martin Thuresson <martint@google.com>
* postreload.c (reload_cse_simplify, reload_cse_simplify_operands,
reload_cse_regs_1): Define testreg in reload_cse_simplify_operands
instead of passing it as function parameter.
Thanks,
Martin

Comments

Hi,
On Fri, 30 Jul 2010, Martin Thuresson wrote:
> This patch updates the handling of temporary registers in postreload.c> to avoid very long build times in certain files.> > By creating new registers instead of updating one existing one using> SET_REGNO it avoids going through the scan df structure.
But this also means generating heaps of garbage for the collector to
collect. I think it would be better to not loose the current optimization
of doing just one gen_reg_RTX(), and rather create a variant of SET_REGNO
that doesn't call df_ref_change_reg_with_loc; SET_REGNO_RAW or something
(or just inline the "XCUINT (RTX, 0, REG) = N" instead of using SET_REGNO
at that place).
Ciao,
Michael.

On Fri, Jul 30, 2010 at 4:57 PM, Michael Matz <matz@suse.de> wrote:
>> Hi,>> On Fri, 30 Jul 2010, Martin Thuresson wrote:>> > This patch updates the handling of temporary registers in postreload.c> > to avoid very long build times in certain files.> >> > By creating new registers instead of updating one existing one using> > SET_REGNO it avoids going through the scan df structure.>> But this also means generating heaps of garbage for the collector to> collect. I think it would be better to not loose the current optimization> of doing just one gen_reg_RTX(), and rather create a variant of SET_REGNO> that doesn't call df_ref_change_reg_with_loc; SET_REGNO_RAW or something> (or just inline the "XCUINT (RTX, 0, REG) = N" instead of using SET_REGNO> at that place).
Thanks for the feedback. I like your suggestion of SET_REGNO_RAW.
I'll update my patch.
Martin
>> Ciao,> Michael.

On 07/31/2010 01:07 AM, Martin Thuresson wrote:
> This patch updates the handling of temporary registers in postreload.c> to avoid very long build times in certain files.> > By creating new registers instead of updating one existing one using> SET_REGNO it avoids going through the scan df structure.> > Im new to gcc RTL and appreciate any feedback.> > In the (inspired from real code) attached source, the time> for "reload CSE regs" went down from 20 usr seconds to less than 1.
I have trouble reproducing the slowness. Which target are you using?
It's a bit unfortunate, and probably avoidable, to create additional
garbage RTL. Maybe what's really needed is
df_set_flags (DF_DEFER_INSN_RESCAN);
at the top of postreload? Can you try that? Or, even simpler, avoid
the SET_REGNO macro, and check all other occurrences of it. There seem
to be a few, e.g. in caller-save.c or ira.c, which also probably
shouldn't invoke df.
Bernd

On 07/31/2010 02:03 AM, Bernd Schmidt wrote:
> It's a bit unfortunate, and probably avoidable, to create additional> garbage RTL. Maybe what's really needed is> df_set_flags (DF_DEFER_INSN_RESCAN);> at the top of postreload? Can you try that?
That's a possibility, but considering postreload is a heavy user of
note_uses/note_stores, deferring rescans makes it impossible to switch
it to use the operand caches someday.
> Or, even simpler, avoid> the SET_REGNO macro, and check all other occurrences of it. There seem> to be a few, e.g. in caller-save.c or ira.c, which also probably> shouldn't invoke df.
Better, yes.
Paolo