[RISCV] Fix a bug in RISCVFrameLowering.
authorHsiangkai Wang <kai.wang@sifive.com>
Fri, 19 Nov 2021 14:57:50 +0000 (22:57 +0800)
committerHsiangkai Wang <kai.wang@sifive.com>
Tue, 30 Nov 2021 02:39:35 +0000 (10:39 +0800)
commit9a88566537177df75af1fcde69e0626fed2b1145
treea56a3fd1d793a61b29a4890fa0a95238ae1b5137
parent4ae2222e143b8541b6567f9852d9600a17cc9426
[RISCV] Fix a bug in RISCVFrameLowering.

When we have out-going arguments passing through stack and we do not
reserve the stack space in the prologue. Use BP to access stack objects
after adjusting the stack pointer before function calls.

callseq_start  ->  sp = sp - reserved_space
//
// Use FP to access fixed stack objects.
// Use BP to access non-fixed stack objects.
//
call @foo
callseq_end    ->  sp = sp + reserved_space

Differential Revision: https://reviews.llvm.org/D114246
llvm/lib/Target/RISCV/RISCVFrameLowering.cpp
llvm/test/CodeGen/RISCV/rvv/no-reserved-frame.ll