https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103335

--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jan Hubicka <hubi...@gcc.gnu.org>:

https://gcc.gnu.org/g:6033b27eade9c31c0be50657094c89ef9068892d

commit r12-5466-g6033b27eade9c31c0be50657094c89ef9068892d
Author: Jan Hubicka <j...@suse.cz>
Date:   Tue Nov 23 10:55:56 2021 +0100

    Improve bytewise DSE

    testcase modref-dse-4.c and modref-dse-5.c fails on some targets because
they
    depend on store merging.  What really happens is that without store merging
    we produce for kill_me combined write that is ao_ref with offset=0, size=32
    and max_size=96.  We have size != max_size becaue we do ont track the info
that
    all 3 writes must happen in a group and conider case only some of them are
done.

    This disables byte-wise DSE which checks that size == max_size.  This is
    completely unnecesary for store being proved to be dead or load being
checked
    to not read live bytes.  It is only necessary for kill store that is used
to
    prove that given store is dead.

    While looking into this I also noticed that we check that everything is
byte
    aligned.  This is also unnecessary and with access merging in modref may
more
    commonly fire on accesses that we could otherwise handle.

    This patch fixes both also also changes interface to normalize_ref that I
found
    confusing since it modifies the ref. Instead of that we have get_byte_range
    that is computing range in bytes (since that is what we need to maintain
the
    bitmap) and has additional parameter specifying if the store in question
should
    be turned into sub-range or super-range depending whether we compute range
    for kill or load.

    gcc/ChangeLog:

    2021-11-23  Jan Hubicka  <hubi...@ucw.cz>

            PR tree-optimization/103335
            * tree-ssa-dse.c (valid_ao_ref_for_dse): Rename to ...
            (valid_ao_ref_kill_for_dse): ... this; do not check that boundaries
            are divisible by BITS_PER_UNIT.
            (get_byte_aligned_range_containing_ref): New function.
            (get_byte_aligned_range_contained_in_ref): New function.
            (normalize_ref): Rename to ...
            (get_byte_range): ... this one; handle accesses not aligned to byte
            boundary; return range in bytes rater than updating ao_ref.
            (clear_live_bytes_for_ref): Take write ref by reference; simplify
using
            get_byte_access.
            (setup_live_bytes_from_ref): Likewise.
            (clear_bytes_written_by): Update.
            (live_bytes_read): Update.
            (dse_classify_store): Simplify tech before live_bytes_read checks.

    gcc/testsuite/ChangeLog:

    2021-11-23  Jan Hubicka  <hubi...@ucw.cz>

            * gcc.dg/tree-ssa/modref-dse-4.c: Update template.
            * gcc.dg/tree-ssa/modref-dse-5.c: Update template.

Reply via email to