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

Kito Cheng via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 2 00:29:06 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
----------------
kito-cheng wrote:

The CFI directive should emit after the tail call, otherwise debugger  will confused when stop at `add a0, s0, a0`
```suggestion
; ILP32E-FPELIM-SAVE-RESTORE-NEXT:    tail __riscv_restore_1
; ILP32E-FPELIM-SAVE-RESTORE-NEXT:    .cfi_restore ra
; ILP32E-FPELIM-SAVE-RESTORE-NEXT:    .cfi_restore s0
```

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


More information about the llvm-commits mailing list