[llvm] [RISCV][CFI] add function epilogue cfi information (PR #110810)

via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 16 06:51:58 PDT 2024


dlav-sc wrote:

> Sorry, those three comments were supposed to come together, like a review. Hopefully they are helpful though. Please test looking at the `frame variable` information (or equivalent in LLDB) at all instruction boundaries in the epilog.

Thanks for your comments, they were quite useful for me

> but I do notice you do insert a .cfi_def_cfa in some other functions before restoring s0, so I'm not sure what went wrong for this function

Sometimes, in order to optimize the resulting assembly, compiler can omit `sp` recovery from `s0` (frame pointer) (e.g. `sp` hasn't changed since the prologue). In such cases compiler also dropped CFI instruction, which updates the CFA after `sp` recovery from `s0` (`.cfi_def_cfa` you've seen in some tests), but that was a mistake. Even if compiler decided to drop `sp` recovery from `s0` it should make the CFA calculation using `sp` either way.

Anyway, I've made a fix: 046146a803d7f34f77b98857ac936dff3f2dae11, 652e5133bde328db0c8d864f429b417680ce3eb9

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


More information about the llvm-commits mailing list