[llvm] [RISCV][CFI] add function epilogue cfi information (PR #110810)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 30 07:51:45 PDT 2024
================
@@ -49,42 +43,42 @@ define void @foo2(i32 %x, float %y) {
; RV32: # %bb.0: # %entry
; RV32-NEXT: cm.push {ra, s0}, -32
; RV32-NEXT: .cfi_def_cfa_offset 32
-; RV32-NEXT: fsw fs0, 12(sp) # 4-byte Folded Spill
; RV32-NEXT: .cfi_offset ra, -8
; RV32-NEXT: .cfi_offset s0, -4
+; RV32-NEXT: fsw fs0, 12(sp) # 4-byte Folded Spill
; RV32-NEXT: .cfi_offset fs0, -20
; RV32-NEXT: fmv.s fs0, fa0
; RV32-NEXT: mv s0, a0
; RV32-NEXT: call bar
; RV32-NEXT: mv a0, s0
; RV32-NEXT: fmv.s fa0, fs0
; RV32-NEXT: flw fs0, 12(sp) # 4-byte Folded Reload
+; RV32-NEXT: .cfi_restore fs0
; RV32-NEXT: cm.pop {ra, s0}, 32
-; RV32-NEXT: .cfi_def_cfa_offset 0
; RV32-NEXT: .cfi_restore ra
; RV32-NEXT: .cfi_restore s0
-; RV32-NEXT: .cfi_restore fs0
+; RV32-NEXT: .cfi_def_cfa_offset 0
; RV32-NEXT: tail func
;
; RV64-LABEL: foo2:
; RV64: # %bb.0: # %entry
; RV64-NEXT: cm.push {ra, s0}, -32
; RV64-NEXT: .cfi_def_cfa_offset 32
-; RV64-NEXT: fsw fs0, 12(sp) # 4-byte Folded Spill
; RV64-NEXT: .cfi_offset ra, -16
; RV64-NEXT: .cfi_offset s0, -8
+; RV64-NEXT: fsw fs0, 12(sp) # 4-byte Folded Spill
; RV64-NEXT: .cfi_offset fs0, -20
; RV64-NEXT: fmv.s fs0, fa0
; RV64-NEXT: mv s0, a0
; RV64-NEXT: call bar
; RV64-NEXT: mv a0, s0
; RV64-NEXT: fmv.s fa0, fs0
; RV64-NEXT: flw fs0, 12(sp) # 4-byte Folded Reload
+; RV64-NEXT: .cfi_restore fs0
; RV64-NEXT: cm.pop {ra, s0}, 32
-; RV64-NEXT: .cfi_def_cfa_offset 0
; RV64-NEXT: .cfi_restore ra
; RV64-NEXT: .cfi_restore s0
-; RV64-NEXT: .cfi_restore fs0
+; RV64-NEXT: .cfi_def_cfa_offset 0
----------------
dlav-sc wrote:
Yeah, I had to change CFI instructions in the prologue, otherwise, I couldn't insert `.cfi_restore` after `cm.pop`.
https://github.com/llvm/llvm-project/pull/110810
More information about the llvm-commits
mailing list