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

--- Comment #1 from Andreas Schwab <sch...@linux-m68k.org> ---
Looks like the miscompilation happens in the pro_and_epilog pass.

Before:

(insn 2520 2519 2521 320 (set (reg:DI 6 t1)
        (symbol_ref/i:DI
("_ZNSt6vectorIN4llvm26BlockFrequencyInfoImplBase13FrequencyDataESaIS2_EE17_M_default_appendEm")
[flags 0x1]  <function_decl 0x7fa72f945900 _M_default_append>))
"/usr/include/c++/10/bits/stl_vector.h":940:21 135 {*movdi_64bit}
     (nil))
(call_insn/j 2521 2520 2522 320 (call (mem:SI (reg:DI 6 t1) [0
_M_default_append S4 A32])
        (const_int 0 [0])) "/usr/include/c++/10/bits/stl_vector.h":940:21 251
{sibcall_internal}
     (expr_list:REG_CALL_DECL (symbol_ref/i:DI
("_ZNSt6vectorIN4llvm26BlockFrequencyInfoImplBase13FrequencyDataESaIS2_EE17_M_default_appendEm")
[flags 0x1]  <function_decl 0x7fa72f945900 _M_default_append>)
        (expr_list:REG_EH_REGION (const_int 0 [0])
            (nil)))
    (expr_list:DI (use (reg:DI 10 a0))
        (expr_list:DI (use (reg:DI 11 a1))
            (nil))))
(barrier 2522 2521 2523)

After:

(insn 2520 2519 5286 317 (set (reg:DI 6 t1)
        (symbol_ref/i:DI
("_ZNSt6vectorIN4llvm26BlockFrequencyInfoImplBase13FrequencyDataESaIS2_EE17_M_default_appendEm")
[flags 0x1]  <function_decl 0x7fa72f945900 _M_default_append>))
"/usr/include/c++/10/bits/stl_vector.h":940:21 135 {*movdi_64bit}
     (nil))
(note 5286 2520 5269 317 NOTE_INSN_EPILOGUE_BEG)
(insn 5269 5286 5270 317 (set (mem:BLK (scratch) [0  A8])
        (unspec:BLK [
                (reg/f:DI 2 sp)
                (reg/f:DI 8 s0)
            ] UNSPEC_TIE))
"../include/llvm/Analysis/BlockFrequencyInfoImpl.h":1145:1 -1
     (nil))
(insn 5270 5269 5271 317 (set (reg:DI 6 t1)
        (const_int 4096 [0x1000]))
"../include/llvm/Analysis/BlockFrequencyInfoImpl.h":1145:1 -1
     (nil))
(insn/f 5271 5270 5272 317 (set (reg/f:DI 2 sp)
        (plus:DI (reg/f:DI 2 sp)
            (reg:DI 6 t1)))
"../include/llvm/Analysis/BlockFrequencyInfoImpl.h":1145:1 -1
     (expr_list:REG_CFA_DEF_CFA (plus:DI (reg/f:DI 2 sp)
            (const_int 384 [0x180]))
        (nil)))
(insn/f 5272 5271 5273 317 (set (reg:DI 1 ra)
        (mem/c:DI (plus:DI (reg/f:DI 2 sp)
                (const_int 376 [0x178])) [537  S8 A64]))
"../include/llvm/Analysis/BlockFrequencyInfoImpl.h":1145:1 -1
     (expr_list:REG_CFA_RESTORE (reg:DI 1 ra)
        (nil)))
(insn/f 5273 5272 5274 317 (set (reg:DI 8 s0)
        (mem/c:DI (plus:DI (reg/f:DI 2 sp)
                (const_int 368 [0x170])) [537  S8 A64]))
"../include/llvm/Analysis/BlockFrequencyInfoImpl.h":1145:1 -1
     (expr_list:REG_CFA_RESTORE (reg:DI 8 s0)
        (nil)))
(insn/f 5274 5273 5275 317 (set (reg:DI 9 s1)
        (mem/c:DI (plus:DI (reg/f:DI 2 sp)
                (const_int 360 [0x168])) [537  S8 A64]))
"../include/llvm/Analysis/BlockFrequencyInfoImpl.h":1145:1 -1
     (expr_list:REG_CFA_RESTORE (reg:DI 9 s1)
        (nil)))
(insn/f 5275 5274 5276 317 (set (reg:DI 18 s2)
        (mem/c:DI (plus:DI (reg/f:DI 2 sp)
                (const_int 352 [0x160])) [537  S8 A64]))
"../include/llvm/Analysis/BlockFrequencyInfoImpl.h":1145:1 -1
     (expr_list:REG_CFA_RESTORE (reg:DI 18 s2)
        (nil)))
(insn/f 5276 5275 5277 317 (set (reg:DI 19 s3)
        (mem/c:DI (plus:DI (reg/f:DI 2 sp)
                (const_int 344 [0x158])) [537  S8 A64]))
"../include/llvm/Analysis/BlockFrequencyInfoImpl.h":1145:1 -1
     (expr_list:REG_CFA_RESTORE (reg:DI 19 s3)
        (nil)))
(insn/f 5277 5276 5278 317 (set (reg:DI 20 s4)
        (mem/c:DI (plus:DI (reg/f:DI 2 sp)
                (const_int 336 [0x150])) [537  S8 A64]))
"../include/llvm/Analysis/BlockFrequencyInfoImpl.h":1145:1 -1
     (expr_list:REG_CFA_RESTORE (reg:DI 20 s4)
        (nil)))
(insn/f 5278 5277 5279 317 (set (reg:DI 21 s5)
        (mem/c:DI (plus:DI (reg/f:DI 2 sp)
                (const_int 328 [0x148])) [537  S8 A64]))
"../include/llvm/Analysis/BlockFrequencyInfoImpl.h":1145:1 -1
     (expr_list:REG_CFA_RESTORE (reg:DI 21 s5)
        (nil)))
(insn/f 5279 5278 5280 317 (set (reg:DI 22 s6)
        (mem/c:DI (plus:DI (reg/f:DI 2 sp)
                (const_int 320 [0x140])) [537  S8 A64]))
"../include/llvm/Analysis/BlockFrequencyInfoImpl.h":1145:1 -1
     (expr_list:REG_CFA_RESTORE (reg:DI 22 s6)
        (nil)))
(insn/f 5280 5279 5281 317 (set (reg:DI 23 s7)
        (mem/c:DI (plus:DI (reg/f:DI 2 sp)
                (const_int 312 [0x138])) [537  S8 A64]))
"../include/llvm/Analysis/BlockFrequencyInfoImpl.h":1145:1 -1
     (expr_list:REG_CFA_RESTORE (reg:DI 23 s7)
        (nil)))
(insn/f 5281 5280 5282 317 (set (reg:DI 24 s8)
        (mem/c:DI (plus:DI (reg/f:DI 2 sp)
                (const_int 304 [0x130])) [537  S8 A64]))
"../include/llvm/Analysis/BlockFrequencyInfoImpl.h":1145:1 -1
     (expr_list:REG_CFA_RESTORE (reg:DI 24 s8)
        (nil)))
(insn/f 5282 5281 5283 317 (set (reg:DI 25 s9)
        (mem/c:DI (plus:DI (reg/f:DI 2 sp)
                (const_int 296 [0x128])) [537  S8 A64]))
"../include/llvm/Analysis/BlockFrequencyInfoImpl.h":1145:1 -1
     (expr_list:REG_CFA_RESTORE (reg:DI 25 s9)
        (nil)))
(insn/f 5283 5282 5284 317 (set (reg:DI 26 s10)
        (mem/c:DI (plus:DI (reg/f:DI 2 sp)
                (const_int 288 [0x120])) [537  S8 A64]))
"../include/llvm/Analysis/BlockFrequencyInfoImpl.h":1145:1 -1
     (expr_list:REG_CFA_RESTORE (reg:DI 26 s10)
        (nil)))
(insn/f 5284 5283 5285 317 (set (reg:DI 27 s11)
        (mem/c:DI (plus:DI (reg/f:DI 2 sp)
                (const_int 280 [0x118])) [537  S8 A64]))
"../include/llvm/Analysis/BlockFrequencyInfoImpl.h":1145:1 -1
     (expr_list:REG_CFA_RESTORE (reg:DI 27 s11)
        (nil)))
(insn/f 5285 5284 2521 317 (set (reg/f:DI 2 sp)
        (plus:DI (reg/f:DI 2 sp)
            (const_int 384 [0x180])))
"../include/llvm/Analysis/BlockFrequencyInfoImpl.h":1145:1 -1
     (expr_list:REG_CFA_DEF_CFA (plus:DI (reg/f:DI 2 sp)
            (const_int 0 [0]))
        (nil)))
(call_insn/j 2521 5285 2522 317 (call (mem:SI (reg:DI 6 t1) [0
_M_default_append S4 A32])
        (const_int 0 [0])) "/usr/include/c++/10/bits/stl_vector.h":940:21 251
{sibcall_internal}
     (expr_list:REG_CALL_DECL (symbol_ref/i:DI
("_ZNSt6vectorIN4llvm26BlockFrequencyInfoImplBase13FrequencyDataESaIS2_EE17_M_default_appendEm")
[flags 0x1]  <function_decl 0x7fa72f945900 _M_default_append>)
        (expr_list:REG_EH_REGION (const_int 0 [0])
            (nil)))
    (expr_list:DI (use (reg:DI 10 a0))
        (expr_list:DI (use (reg:DI 11 a1))
            (nil))))

Reply via email to