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

Uroš Bizjak <ubizjak at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|uros at gcc dot gnu.org            |ubizjak at gmail dot com
          Component|target                      |rtl-optimization

--- Comment #5 from Uroš Bizjak <ubizjak at gmail dot com> ---
(In reply to Richard Biener from comment #3)
> see how the compare is moved very far away from the branch possibly across
> flag clobbering insns (rep movsq?).  Target sounds good.

Scheduler (sched2) pass is moving the compare:

(insn 21 17 22 2 (set (reg:CCZ 17 flags)
        (compare:CCZ (mem/c:DI (plus:DI (reg/f:DI 7 sp)
                    (const_int 8 [0x8])) [1 MEM[(struct Msg &)&t].id+0 S8 A64])
            (const_int 1001 [0x3e9]))) "t4.cpp":32 12 {*cmpdi_1}
     (nil))

in front of rep movsd:

(insn 11 10 12 2 (parallel [
            (set (reg:DI 2 cx [92])
                (const_int 0 [0]))
            (set (reg/f:DI 5 di [90])
                (plus:DI (ashift:DI (reg:DI 2 cx [92])
                        (const_int 3 [0x3]))
                    (reg/f:DI 5 di [90])))
            (set (reg/f:DI 4 si [91])
                (plus:DI (ashift:DI (reg:DI 2 cx [92])
                        (const_int 3 [0x3]))
                    (reg/f:DI 4 si [91])))
            (set (mem/c:BLK (reg/f:DI 5 di [90]) [7 MEM[(struct T *)&t]+0 S232
A128])
                (mem/c:BLK (reg/f:DI 4 si [91]) [7 MEM[(struct T *)&D.2891]+0
S232 A128]))
            (use (reg:DI 2 cx [92]))
        ]) "t4.cpp":31 993 {*rep_movdi_rex64}
     (expr_list:REG_UNUSED (reg:DI 2 cx [92])
        (nil)))

Scheduler doesn't notice that rep movsd target overlaps compare operand.

Looks like rtl-optimization (scheduler) to me.

Reply via email to