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

Richard Earnshaw <rearnsha at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |rearnsha at gcc dot 
gnu.org

--- Comment #16 from Richard Earnshaw <rearnsha at gcc dot gnu.org> ---
I had the wrong set of insns previously. The problem cases are:

(insn/f 8031 8030 8303 4 (set (mem/c:DI (plus:DI (reg/f:DI 31 sp)
                (const_int 696 [0x2b8])) [17  S8 A8])
        (reg:DI 28 x28)) 47 {*movdi_aarch64}
     (expr_list:REG_DEAD (reg:DI 28 x28)
        (expr_list:REG_CFA_OFFSET (set (mem/c:DI (plus:DI (reg/f:DI 31 sp)
                        (const_int 696 [0x2b8])) [17  S8 A8])
                (reg:DI 28 x28))
            (nil))))
(note 8303 8031 7890 4 NOTE_INSN_PROLOGUE_END)
(insn:TI 7890 8303 7889 4 (set (mem/c:DI (plus:DI (reg/f:DI 31 sp)
                (const_int 704 [0x2c0])) [63 %sfp+-2912 S8 A64])
        (reg/f:DI 2 x2 [1833])) "../include/list.h":29:13 47 {*movdi_aarch64}
     (nil))
(insn 7889 7890 7887 4 (set (mem/c:DI (plus:DI (reg/f:DI 31 sp)
                (const_int 712 [0x2c8])) [63 %sfp+-2904 S8 A64])
        (reg/f:DI 3 x3 [1834])) "../include/list.h":29:13 47 {*movdi_aarch64}
     (nil))
(insn:TI 7887 7889 229 4 (set (mem/c:DI (plus:DI (reg/f:DI 31 sp)
                (const_int 720 [0x2d0])) [63 %sfp+-2896 S8 A64])
        (reg/f:DI 4 x4 [1838])) "log.c":422:11 47 {*movdi_aarch64}
     (nil))

Which after peephole2 is transformed to:

(insn/f 8031 8030 8303 4 (set (mem/c:DI (reg:DI 7 x7) [17  S8 A8])
        (reg:DI 28 x28)) 47 {*movdi_aarch64}
     (expr_list:REG_DEAD (reg:DI 28 x28)
        (expr_list:REG_CFA_OFFSET (set (mem/c:DI (plus:DI (reg/f:DI 31 sp)
                        (const_int 696 [0x2b8])) [17  S8 A8])
                (reg:DI 28 x28))
            (nil))))
(note 8303 8031 8556 4 NOTE_INSN_PROLOGUE_END)
(insn 8556 8303 7887 4 (parallel [
            (set (mem/c:DI (plus:DI (reg:DI 7 x7)
                        (const_int 8 [0x8])) [63 %sfp+-2912 S8 A64])
                (reg/f:DI 2 x2 [1833]))
            (set (mem/c:DI (plus:DI (reg:DI 7 x7)
                        (const_int 16 [0x10])) [63 %sfp+-2904 S8 A64])
                (reg/f:DI 3 x3 [1834]))
        ]) "../include/list.h":29:13 -1
     (nil))
(insn:TI 7887 8556 8557 4 (set (mem/c:DI (plus:DI (reg:DI 7 x7)
                (const_int 24 [0x18])) [63 %sfp+-2896 S8 A64])
        (reg/f:DI 4 x4 [1838])) "log.c":422:11 47 {*movdi_aarch64}
     (expr_list:REG_DEAD (reg/f:DI 4 x4 [1838])
        (nil)))

In this case, it looks like one of the 4-store peepholes has been partially
applied, and then failed for some reason, but the modifications have not been
unwound.  (there is then a second peephole that does match the second and third
stores which confuses things a bit).

The reason for the non-match is that one of the insns has a frame-related note
set on it, but the peephole produces three output isns and we can't handle
that.

I think the fix is to make a full copy of the mems before doing the adjust;
then if the change is unwound we haven't modified the original insns by
mistake.

Reply via email to