]> git.ipfire.org Git - thirdparty/gcc.git/commit
LRA: Update insn sp offset if its input reload changes SP
authorVladimir N. Makarov <vmakarov@redhat.com>
Tue, 30 May 2023 19:54:28 +0000 (15:54 -0400)
committerVladimir N. Makarov <vmakarov@redhat.com>
Tue, 30 May 2023 19:57:18 +0000 (15:57 -0400)
commit30038a207c10a2783fa2695b62c7c8458ef05e73
treebbed5f80b155622418f26839285dc843d83846b3
parent2720bbd597f56742a17119dfe80edc2ba86af255
LRA: Update insn sp offset if its input reload changes SP

The patch fixes a bug when there is input reload changing SP.  The bug was
triggered by switching H8300 target to LRA.  The insn in question is

(insn 21 20 22 2 (set (mem/f:SI (pre_dec:SI (reg/f:SI 7 sp)) [3  S4 A32])
        (reg/f:SI 31)) "j.c":10:3 19 {*movsi}
     (expr_list:REG_DEAD (reg/f:SI 31)
        (expr_list:REG_ARGS_SIZE (const_int 4 [0x4])
            (nil))))

The memory address is reloaded but the SP offset for the original insn was not updated.

gcc/ChangeLog:

* lra-int.h (lra_update_sp_offset): Add the prototype.
* lra.cc (setup_sp_offset): Change the return type.  Use
lra_update_sp_offset.
* lra-eliminations.cc (lra_update_sp_offset): New function.
(lra_process_new_insns): Push the current insn to reprocess if the
input reload changes sp offset.
gcc/lra-eliminations.cc
gcc/lra-int.h
gcc/lra.cc