[llvm] [RISCV] Fix incorrect calculation of stack size used by the libcall with the ABI ilp32e and lp64e. (PR #110455)

Sam Elliott via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 8 07:48:31 PDT 2024


lenary wrote:

Sorry for taking some time to get back to this. I was away last week.

Please can you explain a bit more what you mean by "It's always 12 bytes for ilp32e and 24 bytes for lp64e" - I think you mean the current implementation of the save/restore routines always pushes 12/24 bytes, rather than grouping by the stack alignment (as is done for the other ABIs).

Correcting the save/restore routines for the E abis has been on my list to get to, but I've not managed to write up the (toolchain conventions) document changes I think are needed: https://github.com/riscv-non-isa/riscv-toolchain-conventions/issues/35 - it is clear to me the current CFI information emitted by LLVM does not match the current compiler-rt implementation.

I'll also note I have a patch that matches the proposed direction, which tries to minimise stack usage: https://github.com/llvm/llvm-project/pull/95398 - which I think kito and I are in favour of - and this PR would mean the improvement from that other PR would have no effect, and we'd always use the larger stack amounts.

Other related changes and discussions, relating to recent work, which might have useful information in them:
- https://github.com/llvm/llvm-project/pull/95390 (merged)
- https://discourse.llvm.org/t/stack-frame-on-risc-v-with-rve32-and-save-restore/79546/7


https://github.com/llvm/llvm-project/pull/110455


More information about the llvm-commits mailing list