This is the mail archive of the gcc@gcc.gnu.org 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]

CPROP and spec2000 slowdown in mid february


Hi
I was investigating the slowdowns mueasured by spec2000 tester in mid mar
and I beleive that they are related by Richard Kenner's changes to GCSE,
especially CPROP pass.
Fri Feb 16 12:41:30 2001  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>

        * gcse.c (hash_scan_set): If cprop, see if REG_EQUAL or REG_EQUIV.
        Don't CSE a nop.
        (hash_scan_insn): Clean up calls to hash_scan_set.
        (compute_kill_rd): REGNO now unsigned.
        (try_replace_reg): Rework to use simplify_replace_rtx.
        (cprop_jump, cprop_cc0_jump): Likewise.
        (cprop_insn): Call find_reg_equal_equiv_note.
        Reflect changes to cprop_jump and cprop_cc0_jump.


Currently the GCSE and CPROP identifies _much_ more oppurtunities for
optimization as previously, but due to soomehow crazy try_replace_reg
implementation throws away most of these.

Currently, the try_replace_reg works hard as following

1) If function is single_set, try to do simplify_replace_rtx on source
   It does try to throw away rest of paralel to validate change
2) Otherwise it tries validate_repalce_src
3) Otherwise it tries construct note and simplify_replace it.

This concept has several problems. The first part completely ignores
occurences of register in MEM expressions in destionation or the notes,
so many replacement oppurtuinties are lost. Moreover simplify_repalce_rtx
stops on first unknown expression and don't replace inside making it
to lost another substitions. For example many SUBREGs are not handled.
I've partly fixed this by my patch.

The code to throw away members of parallels, clobbers is duplicated in
try_replace_reg and validate_change with the differenc,e that try_replace_reg
is able to throw away the uses or unused sets as well.

Additionally, the code to do simplifications after substitions is present
in validate_replace_src and simplify_replace_rtx and both are broken in
different way.

And lastly, it is really embrasling, that such simmple transformation as
replacing register by constant is so complex and duplicated around the gcc
several times (integrate, fold_rtx, validate_replace_rtx, simplify_replace_rtx
and combine).

So my plan would be to make validate_replace_rtx superset of all the functions
mentioned. I've done this work previously, on unrelated path where I was
trying to kill all occurences of VOIDmode in compares, but it was never
reviewed, so I am asking for ideas here before updating the patches.

Basically I've made validate_replace_rtx to work in similar way as combine.
To first recurse on parameters and then try simplification if some of
parameters were clobbered.  Unlike current, somewhat weird scheme, this
makes us to simplify properly cases, where simplifications are nested, so
we avoid producing ambiguous RTL, as current validate_replace_rtx does.

In second step, I've changed validate_replace_rtx to take callback to function
performing changes, so I was able to replace the fucntion in integrate.c
to simplify constants for multiple registers as well as implement
validate_simplify_rtx, that simply calls simplify_rtx on each expression.

With such infrastructure+the change to apply_change_group to throw away
uses and unused sets, I think I can superceede the current scheme with nice
and consistent infrastructure. In longer term perhaps even replace
combine subst function by this beast, if Richard Kenner suceeds with his
plan of making combine's simplifiers independent on the rest of infrastucture.
In short term at least kill part in integrate.c, try_replace_reg, 
simplify_replace_rtx and fold_rtx.

What do you think?
Honza


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