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

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

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

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
In this case it is because this transformation (mov $0, reg to xor reg, reg) is
done during peephole2 and on this testcase it isn't possible, because we have:
(insn 28 4 21 2 (set (reg/v:SI 0 ax [orig:83 <retval> ] [83])
        (plus:SI (reg:SI 5 di [88])
            (const_int 1234 [0x4d2]))) "pr88712.c":4:7 186 {*leasi}
     (expr_list:REG_DEAD (reg:SI 5 di [88])
        (nil)))
(insn 21 28 26 2 (set (reg:CCZ 17 flags)
        (compare:CCZ (mem:SI (reg:DI 4 si [89]) [1 *ptr_6(D)+0 S4 A32])
            (reg/v:SI 0 ax [orig:83 <retval> ] [83]))) "pr88712.c":6:9 11
{*cmpsi_1}
     (expr_list:REG_DEAD (reg:DI 4 si [89])
        (nil)))
(insn 26 21 23 2 (set (reg:SI 1 dx [87])
        (const_int 0 [0])) "pr88712.c":6:9 67 {*movsi_internal}
     (expr_list:REG_EQUIV (const_int 0 [0])
        (nil)))
(insn 23 26 18 2 (set (reg/v:SI 0 ax [orig:83 <retval> ] [83])
        (if_then_else:SI (ne (reg:CCZ 17 flags)
                (const_int 0 [0]))
            (reg/v:SI 0 ax [orig:83 <retval> ] [83])
            (reg:SI 1 dx [87]))) "pr88712.c":6:9 939 {*movsicc_noc}
     (expr_list:REG_DEAD (reg:CCZ 17 flags)
        (expr_list:REG_DEAD (reg:SI 1 dx [87])
            (nil))))
so the clearing of %edx is sandwiched in between the cmp and cmov.  Later on in
this case sched2 reorders those and so we at that point could replace it, but
we don't have another peephole2 pass and passes after sched2 don't have the
needed infrastructure to check if the flags are dead (because movl $0, reg
doesn't clobber flags, but xorl reg, reg does).

Reply via email to