[PATCH] D114246: [RISCV] Fix a bug in RISCVFrameLowering.

Hsiangkai Wang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Nov 27 06:08:43 PST 2021


HsiangKai added a comment.

In D114246#3152595 <https://reviews.llvm.org/D114246#3152595>, @luismarques wrote:

> Can you describe this issue in more detail, please? I'm not following it at the moment.
>
> We have a dynamic stack change with the `sub sp, sp, a1`.  I don't see any more dynamic changes after that. The test case then does a bunch of BP-relative loads and stores but the BP has the same value as the SP so we could just perform SP-relative accesses... no? Was the BP meant to be copied from the SP before the dynamic SP change?

As Craig depicted, there is an additional stack change before the function call, `gfunc`, to reserve a stack space for out-going arguments for the function call. After the stack changes, we should not use sp to access the stack objects. In this patch, it uses bp to access stack objects if the prologue does not preserve the space for out-going arguments and there are any out-going arguments to pass to callee.

I have a patch to add a test case to show the bug in D114245 <https://reviews.llvm.org/D114245>.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D114246/new/

https://reviews.llvm.org/D114246



More information about the llvm-commits mailing list