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

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

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

commit r12-9149-g7bd8b65bd5d51a33f31ec39dfb435b84e36260e9
Author: Jakub Jelinek <ja...@redhat.com>
Date:   Wed Feb 1 12:52:52 2023 +0100

    ree: Fix -fcompare-debug issues in combine_reaching_defs [PR108573]

    The PR78437 r7-4871 changes made combine_reaching_defs punt on
    WORD_REGISTER_OPERATIONS targets if a setter of smaller than word
    register has wider uses.  This unfortunately breaks -fcompare-debug,
    because if such a use appears only in DEBUG_INSN(s), while all other
    uses aren't wider than the setter, we can REE optimize it without -g
    and not with -g.

    Such decisions shouldn't be based on debug instructions.  We could try
    to reset them or adjust in some other way after we decide to perform the
    change, but at least on the testcase which used to fail on riscv64-linux
    the
    (debug_insn 8 7 9 2 (var_location:HI s (minus:HI (subreg:HI (and:DI (reg:DI
10 a0 [160])
                    (const_int 1 [0x1])) 0)
            (subreg:HI (ashiftrt:DI (reg/v:DI 9 s1 [orig:151 l ] [151])
                    (debug_expr:SI D#1)) 0))) "pr108573.c":12:5 -1
         (nil))
    clearly doesn't care about the upper bits and I have hard time imaging how
    could one end up with DEBUG_INSN which actually cares about those upper
    bits.

    So, the following patch just ignores uses on DEBUG_INSNs in this case,
    if we run into something where we'd need to do something further later on,
    let's deal with it when we have a testcase for it.

    2023-02-01  Jakub Jelinek  <ja...@redhat.com>

            PR debug/108573
            * ree.cc (combine_reaching_defs): Don't return false for
paradoxical
            subregs in DEBUG_INSNs.

            * gcc.dg/pr108573.c: New test.

    (cherry picked from commit e4473d7cf871c8ddf8f22d105c5af6375ebe37bf)

Reply via email to