[llvm] [RISCV] Use SP-relative Accesses with frame pointers (PR #171780)

Sam Elliott via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 11 02:03:33 PST 2025


lenary wrote:

> * We should not do this if the frame size is too large? Finding a good threshold for this might be hard. I guess if the Frame size is over 256 for rv32, and 512 for rv64?

It would be better to make this decision based on the offset from either `sp` or `fp`, which we should be able to find out. The real function we're trying to change the behaviour of is `RISCVFrameLowering::getFrameIndexReference`.

`RISCVTargetLowering::lowerFRAMEADDR` is also likely wrong now. I think the line `Register FrameReg = RI.getFrameRegister(MF);` should probably read `Register FrameReg = RISCV::X8;` but I'm not entirely sure. 

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


More information about the llvm-commits mailing list