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

via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Oct 2 16:59:34 PDT 2024


================
@@ -62,6 +69,8 @@ define i32 @callee_float_in_regs(i32 %a, float %b) {
 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT:    mv a0, a1
 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT:    call __fixsfsi
 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT:    add a0, s0, a0
+; ILP32E-FPELIM-SAVE-RESTORE-NEXT:    .cfi_restore ra
+; ILP32E-FPELIM-SAVE-RESTORE-NEXT:    .cfi_restore s0
 ; ILP32E-FPELIM-SAVE-RESTORE-NEXT:    tail __riscv_restore_1
----------------
dlav-sc wrote:

addressed.

Yeah, I didn't take into account libcalls at all :) Anyway, I made a fix (5cf8f319fbc5304c21e05d5ec3d2aff1713bd071) and updated tests (e6f1c940894489859e75b944978d42fcdffdec8e). Could you take a look, please? 

However, tests don't look like you've expected, because in fact it is unnecessary to emit CFI instructions after `tail __riscv_restore_1`, which is considered as a terminator. Therefor, I just removed `.cfi_restore` and placed `.cfi_def_cfa_offset` instructions where they should be.

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


More information about the llvm-branch-commits mailing list