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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |segher at gcc dot gnu.org

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(gdb) p debug_rtx (reg_stat.m_vec.m_vecdata[91].last_set)
(insn 21 20 22 2 (parallel [
            (set (reg/v:SI 91 [ p ])
                (and:SI (reg/v:SI 91 [ p ])
                    (const_int 65534 [0xfffe])))
            (clobber (reg:CC 17 flags))
        ]) "pr79388.c":11 389 {*andsi_1}
     (expr_list:REG_UNUSED (reg:CC 17 flags)
        (nil)))

looks correct, but

(gdb) p debug_rtx (reg_stat.m_vec.m_vecdata[91].last_set_value)
(and:SI (const_int 0 [0])
    (const_int 65534 [0xfffe]))

looks wrong.

The problem is that during:
#1  0x0000000001849ddc in record_value_for_reg (reg=0x7fffefc124b0,
insn=0x7fffefad2700, value=0x7fffefc12570) at ../../gcc/combine.c:12959
#2  0x000000000184a105 in record_dead_and_set_regs_1 (dest=0x7fffefc124b0,
setter=0x7fffefc12588, data=0x7fffefad2700)
    at ../../gcc/combine.c:13059
#3  0x0000000000e16e6f in note_stores (x=0x7fffefc12588, fun=0x184a052
<record_dead_and_set_regs_1(rtx, const_rtx, void*)>, data=0x7fffefad2700)
    at ../../gcc/rtlanal.c:1846
#4  0x0000000000e16eba in note_stores (x=0x7fffefbefa10, fun=0x184a052
<record_dead_and_set_regs_1(rtx, const_rtx, void*)>, data=0x7fffefad2700)
    at ../../gcc/rtlanal.c:1851
#5  0x000000000184a48a in record_dead_and_set_regs (insn=0x7fffefad2700) at
../../gcc/combine.c:13140
on insn 21 we have dest (reg/v:SI 91 [ p ]) and value (and:SI (reg/v:SI 91 [ p
]) (const_int 65534 [0xfffe])), and get_last_value on the REG 91 is wrong:
(gdb) p debug_rtx (reg_stat.m_vec.m_vecdata[91].last_set_value)
(const_int 0 [0])
$122 = void
(gdb) p debug_rtx (reg_stat.m_vec.m_vecdata[91].last_set)
(note 16 15 18 2 NOTE_INSN_DELETED)

insn 16 is former:
(insn 16 15 18 2 (parallel [
            (set (reg/v:SI 91 [ p ])
                (lshiftrt:SI (subreg:SI (reg:DI 98) 0)
                    (const_int 15 [0xf])))
            (clobber (reg:CC 17 flags))
        ]) "pr79388.c":11 542 {*lshrsi3_1}
     (expr_list:REG_DEAD (reg:DI 98)
        (expr_list:REG_UNUSED (reg:CC 17 flags)
            (expr_list:REG_EQUAL (udiv:SI (reg:SI 89 [ _7 ])
                    (const_int 65535 [0xffff]))
                (nil)))))

so it seems something forgot to invalidate the last value or something similar.
REG_N_SETS (91) is 3.
Segher, any ideas?

Reply via email to