RISC-V: Disable remove unneeded save-restore call optimization if there are any argum...
authorKito Cheng <kito.cheng@sifive.com>
Fri, 3 Jul 2020 05:49:51 +0000 (13:49 +0800)
committerKito Cheng <kito.cheng@sifive.com>
Thu, 9 Jul 2020 06:29:29 +0000 (14:29 +0800)
commit4c0d1322033ce979532425d336530b217f6b5fd3
tree2231cca0d2c4bb3fd18d79df4ae435364f8edcf8
parent50873cc588fcc20384212b6dddca74393023a0e3
RISC-V: Disable remove unneeded save-restore call optimization if there are any arguments on stack.

 - This optimization will adjust stack, but it not check/update other
   stack pointer use-site, the example is when the arguments put on
   stack, the offset become wrong after optimization.

 - However adjust stack frame usage after register allocation could be
   error prone, so we decide to turn off this optimization for such case.

 - Ye-Ting Kuo report this issue on github:
   https://github.com/riscv/riscv-gcc/pull/192

gcc/ChangeLog:

* config/riscv/riscv-sr.c (riscv_remove_unneeded_save_restore_calls):
Abort if any arguments on stack.

gcc/testsuite/ChangeLog

* gcc.target/riscv/save-restore-9.c: New.
gcc/config/riscv/riscv-sr.c
gcc/testsuite/gcc.target/riscv/save-restore-9.c [new file with mode: 0644]