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

--- Comment #21 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Jakub Jelinek
<ja...@gcc.gnu.org>:

https://gcc.gnu.org/g:7a2f91d413eb7a3eb0ba52c7ac9618a35addd12a

commit r10-9721-g7a2f91d413eb7a3eb0ba52c7ac9618a35addd12a
Author: Jakub Jelinek <ja...@redhat.com>
Date:   Sat Apr 3 10:07:09 2021 +0200

    dse: Fix up hard reg conflict checking in replace_read [PR99863]

    Since PR37922 fix RTL DSE has hard register conflict checking
    in replace_read, so that if the replacement sequence sets (or typically
just
    clobbers) some hard register (usually condition codes) we verify that
    hard register is not live.
    Unfortunately, it compares the hard reg set clobbered/set by the sequence
    (regs_set) against the currently live hard register set, but it then
    emits the insn sequence not at the current insn position, but before
    store_insn->insn.
    So, we should not compare against the current live hard register set,
    but against the hard register live set at the point of the store insn.
    Fortunately, we already have that remembered in
store_insn->fixed_regs_live.

    In addition to bootstrapping/regtesting this patch on x86_64-linux and
    i686-linux, I've also added statistics gathering and it seems the only
    place where we end up rejecting the replace_read is the newly added
    testcase (the PR37922 is no longer effective at that) and fixed_regs_live
    has been always non-NULL at the if (store_insn->fixed_regs_live) spot.
    Rather than having there an assert, I chose to just keep regs_set
    as is, which means in that hypothetical case where fixed_regs_live wouldn't
    be computed for some store we'd still accept sequences that don't
    clobber/set any hard registers and just punt on those that clobber/set
    those.

    2021-04-03  Jakub Jelinek  <ja...@redhat.com>

            PR rtl-optimization/99863
            * dse.c (replace_read): Drop regs_live argument.  Instead of
            regs_live, use store_insn->fixed_regs_live if non-NULL,
            otherwise punt if insns sequence clobbers or sets any hard
            registers.

            * gcc.target/i386/pr99863.c: New test.

    (cherry picked from commit 9c7473688e78dc41fd4312a983453df195dd7786)

Reply via email to