On Wed, Nov 12, 2014 at 7:08 PM, Vladimir Makarov <vmaka...@redhat.com> wrote:
>   After submitting LRA rematerialization patch, I got a lot of
> feedback.  Some people reported performance degradation and pointed me
> out the most important problem which looks like
>
>   p0 <- p1 + p2                      p0 <- p1 + p2
>   spilled_pseudo <- p0               spilled_pseudo <- p0
>
>    ... some code                 =>
>
>   p3 <- spilled_pseudo                p3 <- p1 + p2
>
>   The first 2 insns were not removed and the second one became a dead
> store.  It was hard to fix as LRA (and reload pass) does mostly local
> transformations (in BB or EBB).  It could be fixed in BB or EBB.  But
> some important cases (e.g. the code between is a loop) still will be
> missed and will result in the same problem.  To fix this in right way,
> we needed to update the global live info.
>
>  A recent Intel project on reuse of pic register came to problems
> which need a global live analysis too in LRA to fix them.  For
> rematerialization, it is a matter of better code generation but for
> reuse of pic register project it is a matter of correct code
> generation.
>
>   So the last two weeks I worked on global live analysis in LRA and
> submitted the patch 3 days ago.  The rematerialization patch here is
> mostly the same I sent month ago.  I added only small changes to adapt
> it to global live analysis and fix some tests failures I found on
> ppc64.
>
>   The patch with live analysis generates smaller and a better code
> than before.  Last time I reported only 1% SPECFP2000 improvement on
> ARM.  Now I see about 0.4% SPECFP2000 improvement on x86-64 too.


Hi Vlad,
  I find this miscompiles glibc on aarch64.
I filed https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63906 to record this issue.
My analysis so far has found that it is rematerizing the new value of
sp where the old value of sp is needed after an alloca.

Thanks,
Andrew Pinski

>
>   So I've committed the rematerialization patch to the trunk as rev. 217458.
>
>   As I wrote its initial version of rematerialziation.  Other
> people and me proposed several ideas how to improve it in the future.
>
> 2014-11-12  Vladimir Makarov  <vmaka...@redhat.com>
>
>         * common.opt (flra-remat): New.
>         * opts.c (default_options_table): Add entry for flra_remat.
>         * timevar_def (TV_LRA_REMAT): New.
>         * doc/invoke.texi (-flra-remat): Add description of the new
>         option.
>         * doc/passes.texi (-flra-remat): Remove lra-equivs.c and
>         lra-saves.c.  Add lra-remat.c.
>         * Makefile.in (OBJS): Add lra-remat.o.
>         * lra-remat.c: New file.
>         * lra.c: Add info about the rematerialization pass in the top
>         comment.
>         (collect_non_operand_hard_regs, add_regs_to_insn_regno_info):
>         Process unallocatable regs too.
>         (lra_constraint_new_insn_uid_start): Remove.
>         (lra): Add code for calling rematerialization sub-pass.
>         * lra-int.h (lra_constraint_new_insn_uid_start): Remove.
>         (lra_constrain_insn, lra_remat): New prototypes.
>         (lra_eliminate_regs_1): Add parameter.
>         * lra-lives.c (make_hard_regno_born, make_hard_regno_dead):
>         Process unallocatable hard regs too.
>         (process_bb_lives): Ditto.
>         * lra-spills.c (remove_pseudos): Add argument to
>         lra_eliminate_regs_1 call.
>         * lra-eliminations.c (lra_eliminate_regs_1): Add parameter.  Use it
>         for sp offset calculation.
>         (lra_eliminate_regs): Add argument for lra_eliminate_regs_1 call.
>         (eliminate_regs_in_insn): Add parameter.  Use it for sp offset
>         calculation.
>         (process_insn_for_elimination): Add argument for
>         eliminate_regs_in_insn call.
>         * lra-constraints.c (get_equiv_with_elimination):  Add argument
>         for lra_eliminate_regs_1 call.
>         (process_addr_reg): Add parameter.  Use it.
>         (process_address_1): Ditto.  Add argument for process_addr_reg
>         call.
>         (process_address): Ditto.
>         (curr_insn_transform): Add parameter.  Use it.  Add argument for
>         process_address calls.
>         (lra_constrain_insn): New function.
>         (lra_constraints): Add argument for curr_insn_transform call.
>
>
>

Reply via email to