Updated LRA rematerialization patch has been committed

H.J. Lu hjl.tools@gmail.com
Thu Nov 13 04:07:00 GMT 2014


On Wed, Nov 12, 2014 at 7:08 PM, Vladimir Makarov <vmakarov@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.
>
>   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  <vmakarov@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.
>

Unfortunately, it breaks bootstrap on Linux/ia32:

https://gcc.gnu.org/ml/gcc-regression/2014-11/msg00288.html

../../../src-trunk/libgcc/config/libbid/bid_round.c: In function
â__bid_round128_19_38â:
../../../src-trunk/libgcc/config/libbid/bid_round.c:391:1: internal
compiler error: Segmentation fault
 }
 ^
/export/gnu/import/git/gcc-test-ia32corei7/bld/./gcc/xgcc
-B/export/gnu/import/git/gcc-test-ia32corei7/bld/./gcc/
-B/usr/5.0.0/i686-linux/bin/ -B/usr/5.0.0/i686-linux/lib/ -isystem
/usr/5.0.0/i686-linux/include -isystem
/usr/5.0.0/i686-linux/sys-include    -g -O2 -O2  -g -O2 -DIN_GCC    -W
-Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wstrict-prototypes
-Wmissing-prototypes -Wold-style-definition  -isystem ./include
-fpic -mlong-double-80 -g -DIN_LIBGCC2 -fbuilding-libgcc
-fno-stack-protector   -fpic -mlong-double-80 -I. -I. -I../.././gcc
-I../../../src-trunk/libgcc -I../../../src-trunk/libgcc/.
-I../../../src-trunk/libgcc/../gcc
-I../../../src-trunk/libgcc/../include
-I../../../src-trunk/libgcc/config/libbid -DENABLE_DECIMAL_BID_FORMAT
-DHAVE_CC_TLS  -DUSE_TLS -o bid128.o -MT bid128.o -MD -MP -MF
bid128.dep -c ../../../src-trunk/libgcc/config/libbid/bid128.c
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
make[6]: *** [bid_round.o] Error 1

when configured with

--with-arch=corei7 --with-cpu=corei7 --prefix=/usr/5.0.0
--enable-clocale=gnu --with-system-zlib --enable-shared
--with-demangler-in-ld i686-linux --with-fpmath=sse
--enable-languages=c,c++,fortran,java,lto,objc


H.J.



-- 
H.J.



More information about the Gcc-patches mailing list