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

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Actually, I believe the bug is already at fwprop1.
We have:
(insn 247 246 18 2 (set (reg:DI 301 [ u128_0 ])
        (const_int 0 [0])) pr70574.c:7 85 {*movdi_internal}
     (nil))
(insn 18 247 19 2 (set (reg:QI 115)
        (not:QI (subreg:QI (reg:DI 301 [ u128_0 ]) 0))) pr70574.c:8 506
{*one_cmplqi2_1}
     (nil))
...
(insn 31 30 32 2 (set (reg:SI 128)
        (subreg:SI (reg:QI 115) 0)) pr70574.c:8 86 {*movsi_internal}
     (nil))
and fwprop1 does:
In insn 31, replacing
 (subreg:SI (reg:QI 115) 0)
 with (const_int -1 [0xffffffffffffffff])
Changes to insn 31 not profitable
 Setting REG_EQUAL note
and that turns insn 31 into:
(insn 31 29 32 2 (set (reg:SI 128)
        (subreg:SI (reg:QI 115) 0)) pr70574.c:8 86 {*movsi_internal}
     (expr_list:REG_EQUAL (const_int -1 [0xffffffffffffffff])
        (expr_list:REG_DEAD (reg:QI 115)
            (nil))))
(and correctly modifies insn 18 first to (set (reg:QI 115) (const_int -1))).
The bug is in the REG_EQUAL note, (subreg:SI (reg:QI 115) 0), a paradoxical
subreg of QImode -1, is not equivalent to SImode -1.  So, either fwprop should
have replaced it the paradoxical subreg with CONST_INT, or it shouldn't add the
REG_EQUAL note.

Reply via email to