diff --git a/llvm/test/CodeGen/RISCV/GlobalISel/vararg.ll b/llvm/test/CodeGen/RISCV/GlobalISel/vararg.ll index 55c0abf531ac1a..972cc9d66bfb71 100644 --- a/llvm/test/CodeGen/RISCV/GlobalISel/vararg.ll +++ b/llvm/test/CodeGen/RISCV/GlobalISel/vararg.ll @@ -112,6 +112,7 @@ define i32 @va1(ptr %fmt, ...) { ; RV32-WITHFP-NEXT: addi a1, a0, 4 ; RV32-WITHFP-NEXT: sw a1, -12(s0) ; RV32-WITHFP-NEXT: lw a0, 0(a0) +; RV32-WITHFP-NEXT: .cfi_def_cfa sp, 48 ; RV32-WITHFP-NEXT: lw ra, 12(sp) # 4-byte Folded Reload ; RV32-WITHFP-NEXT: lw s0, 8(sp) # 4-byte Folded Reload ; RV32-WITHFP-NEXT: .cfi_restore ra @@ -149,6 +150,7 @@ define i32 @va1(ptr %fmt, ...) { ; RV64-WITHFP-NEXT: sw a1, -24(s0) ; RV64-WITHFP-NEXT: sw a2, -20(s0) ; RV64-WITHFP-NEXT: lw a0, 0(a0) +; RV64-WITHFP-NEXT: .cfi_def_cfa sp, 96 ; RV64-WITHFP-NEXT: ld ra, 24(sp) # 8-byte Folded Reload ; RV64-WITHFP-NEXT: ld s0, 16(sp) # 8-byte Folded Reload ; RV64-WITHFP-NEXT: .cfi_restore ra @@ -1692,7 +1694,7 @@ define i32 @va_large_stack(ptr %fmt, ...) { ; RV32-WITHFP-NEXT: lui a1, 24414 ; RV32-WITHFP-NEXT: addi a1, a1, -1728 ; RV32-WITHFP-NEXT: add sp, sp, a1 -; RV32-WITHFP-NEXT: .cfi_def_cfa_offset 2032 +; RV32-WITHFP-NEXT: .cfi_def_cfa sp, 2032 ; RV32-WITHFP-NEXT: lw ra, 1996(sp) # 4-byte Folded Reload ; RV32-WITHFP-NEXT: lw s0, 1992(sp) # 4-byte Folded Reload ; RV32-WITHFP-NEXT: .cfi_restore ra @@ -1738,7 +1740,7 @@ define i32 @va_large_stack(ptr %fmt, ...) { ; RV64-WITHFP-NEXT: lui a1, 24414 ; RV64-WITHFP-NEXT: addiw a1, a1, -1680 ; RV64-WITHFP-NEXT: add sp, sp, a1 -; RV64-WITHFP-NEXT: .cfi_def_cfa_offset 2032 +; RV64-WITHFP-NEXT: .cfi_def_cfa sp, 2032 ; RV64-WITHFP-NEXT: ld ra, 1960(sp) # 8-byte Folded Reload ; RV64-WITHFP-NEXT: ld s0, 1952(sp) # 8-byte Folded Reload ; RV64-WITHFP-NEXT: .cfi_restore ra @@ -1811,6 +1813,7 @@ define iXLen @va_vprintf(ptr %fmt, ptr %arg_start) { ; RV32-WITHFP-NEXT: addi a1, a0, 4 ; RV32-WITHFP-NEXT: sw a1, -16(s0) ; RV32-WITHFP-NEXT: lw a0, 0(a0) +; RV32-WITHFP-NEXT: .cfi_def_cfa sp, 16 ; RV32-WITHFP-NEXT: lw ra, 12(sp) # 4-byte Folded Reload ; RV32-WITHFP-NEXT: lw s0, 8(sp) # 4-byte Folded Reload ; RV32-WITHFP-NEXT: .cfi_restore ra @@ -1838,6 +1841,7 @@ define iXLen @va_vprintf(ptr %fmt, ptr %arg_start) { ; RV64-WITHFP-NEXT: addi a1, a0, 8 ; RV64-WITHFP-NEXT: sd a1, -32(s0) ; RV64-WITHFP-NEXT: ld a0, 0(a0) +; RV64-WITHFP-NEXT: .cfi_def_cfa sp, 32 ; RV64-WITHFP-NEXT: ld ra, 24(sp) # 8-byte Folded Reload ; RV64-WITHFP-NEXT: ld s0, 16(sp) # 8-byte Folded Reload ; RV64-WITHFP-NEXT: .cfi_restore ra @@ -1922,6 +1926,7 @@ define i32 @va_printf(ptr %fmt, ...) { ; RV32-WITHFP-NEXT: sw a6, 24(s0) ; RV32-WITHFP-NEXT: sw a7, 28(s0) ; RV32-WITHFP-NEXT: call va_vprintf +; RV32-WITHFP-NEXT: .cfi_def_cfa sp, 48 ; RV32-WITHFP-NEXT: lw ra, 12(sp) # 4-byte Folded Reload ; RV32-WITHFP-NEXT: lw s0, 8(sp) # 4-byte Folded Reload ; RV32-WITHFP-NEXT: .cfi_restore ra @@ -1951,6 +1956,7 @@ define i32 @va_printf(ptr %fmt, ...) { ; RV64-WITHFP-NEXT: sd a6, 48(s0) ; RV64-WITHFP-NEXT: sd a7, 56(s0) ; RV64-WITHFP-NEXT: call va_vprintf +; RV64-WITHFP-NEXT: .cfi_def_cfa sp, 96 ; RV64-WITHFP-NEXT: ld ra, 24(sp) # 8-byte Folded Reload ; RV64-WITHFP-NEXT: ld s0, 16(sp) # 8-byte Folded Reload ; RV64-WITHFP-NEXT: .cfi_restore ra diff --git a/llvm/test/CodeGen/RISCV/callee-saved-gprs.ll b/llvm/test/CodeGen/RISCV/callee-saved-gprs.ll index f6adf74a34207c..c6d98531ca6d09 100644 --- a/llvm/test/CodeGen/RISCV/callee-saved-gprs.ll +++ b/llvm/test/CodeGen/RISCV/callee-saved-gprs.ll @@ -2503,6 +2503,7 @@ define void @foo() { ; RV32I-WITH-FP-NEXT: #APP ; RV32I-WITH-FP-NEXT: li s4, 0 ; RV32I-WITH-FP-NEXT: #NO_APP +; RV32I-WITH-FP-NEXT: .cfi_def_cfa sp, 16 ; RV32I-WITH-FP-NEXT: lw ra, 12(sp) # 4-byte Folded Reload ; RV32I-WITH-FP-NEXT: lw s0, 8(sp) # 4-byte Folded Reload ; RV32I-WITH-FP-NEXT: lw s4, 4(sp) # 4-byte Folded Reload @@ -2541,6 +2542,7 @@ define void @foo() { ; RV32IZCMP-WITH-FP-NEXT: #APP ; RV32IZCMP-WITH-FP-NEXT: li s4, 0 ; RV32IZCMP-WITH-FP-NEXT: #NO_APP +; RV32IZCMP-WITH-FP-NEXT: .cfi_def_cfa sp, 16 ; RV32IZCMP-WITH-FP-NEXT: lw ra, 12(sp) # 4-byte Folded Reload ; RV32IZCMP-WITH-FP-NEXT: lw s0, 8(sp) # 4-byte Folded Reload ; RV32IZCMP-WITH-FP-NEXT: lw s4, 4(sp) # 4-byte Folded Reload @@ -2588,6 +2590,7 @@ define void @foo() { ; RV64I-WITH-FP-NEXT: #APP ; RV64I-WITH-FP-NEXT: li s4, 0 ; RV64I-WITH-FP-NEXT: #NO_APP +; RV64I-WITH-FP-NEXT: .cfi_def_cfa sp, 32 ; RV64I-WITH-FP-NEXT: ld ra, 24(sp) # 8-byte Folded Reload ; RV64I-WITH-FP-NEXT: ld s0, 16(sp) # 8-byte Folded Reload ; RV64I-WITH-FP-NEXT: ld s4, 8(sp) # 8-byte Folded Reload @@ -2626,6 +2629,7 @@ define void @foo() { ; RV64IZCMP-WITH-FP-NEXT: #APP ; RV64IZCMP-WITH-FP-NEXT: li s4, 0 ; RV64IZCMP-WITH-FP-NEXT: #NO_APP +; RV64IZCMP-WITH-FP-NEXT: .cfi_def_cfa sp, 32 ; RV64IZCMP-WITH-FP-NEXT: ld ra, 24(sp) # 8-byte Folded Reload ; RV64IZCMP-WITH-FP-NEXT: ld s0, 16(sp) # 8-byte Folded Reload ; RV64IZCMP-WITH-FP-NEXT: ld s4, 8(sp) # 8-byte Folded Reload @@ -2679,6 +2683,7 @@ define void @bar() { ; RV32I-WITH-FP-NEXT: #APP ; RV32I-WITH-FP-NEXT: li s11, 0 ; RV32I-WITH-FP-NEXT: #NO_APP +; RV32I-WITH-FP-NEXT: .cfi_def_cfa sp, 16 ; RV32I-WITH-FP-NEXT: lw ra, 12(sp) # 4-byte Folded Reload ; RV32I-WITH-FP-NEXT: lw s0, 8(sp) # 4-byte Folded Reload ; RV32I-WITH-FP-NEXT: lw s11, 4(sp) # 4-byte Folded Reload @@ -2717,6 +2722,7 @@ define void @bar() { ; RV32IZCMP-WITH-FP-NEXT: #APP ; RV32IZCMP-WITH-FP-NEXT: li s11, 0 ; RV32IZCMP-WITH-FP-NEXT: #NO_APP +; RV32IZCMP-WITH-FP-NEXT: .cfi_def_cfa sp, 16 ; RV32IZCMP-WITH-FP-NEXT: lw ra, 12(sp) # 4-byte Folded Reload ; RV32IZCMP-WITH-FP-NEXT: lw s0, 8(sp) # 4-byte Folded Reload ; RV32IZCMP-WITH-FP-NEXT: lw s11, 4(sp) # 4-byte Folded Reload @@ -2764,6 +2770,7 @@ define void @bar() { ; RV64I-WITH-FP-NEXT: #APP ; RV64I-WITH-FP-NEXT: li s11, 0 ; RV64I-WITH-FP-NEXT: #NO_APP +; RV64I-WITH-FP-NEXT: .cfi_def_cfa sp, 32 ; RV64I-WITH-FP-NEXT: ld ra, 24(sp) # 8-byte Folded Reload ; RV64I-WITH-FP-NEXT: ld s0, 16(sp) # 8-byte Folded Reload ; RV64I-WITH-FP-NEXT: ld s11, 8(sp) # 8-byte Folded Reload @@ -2802,6 +2809,7 @@ define void @bar() { ; RV64IZCMP-WITH-FP-NEXT: #APP ; RV64IZCMP-WITH-FP-NEXT: li s11, 0 ; RV64IZCMP-WITH-FP-NEXT: #NO_APP +; RV64IZCMP-WITH-FP-NEXT: .cfi_def_cfa sp, 32 ; RV64IZCMP-WITH-FP-NEXT: ld ra, 24(sp) # 8-byte Folded Reload ; RV64IZCMP-WITH-FP-NEXT: ld s0, 16(sp) # 8-byte Folded Reload ; RV64IZCMP-WITH-FP-NEXT: ld s11, 8(sp) # 8-byte Folded Reload @@ -2876,6 +2884,7 @@ define void @varargs(...) { ; RV32I-WITH-FP-NEXT: sw a2, 8(s0) ; RV32I-WITH-FP-NEXT: sw a3, 12(s0) ; RV32I-WITH-FP-NEXT: call callee +; RV32I-WITH-FP-NEXT: .cfi_def_cfa sp, 48 ; RV32I-WITH-FP-NEXT: lw ra, 12(sp) # 4-byte Folded Reload ; RV32I-WITH-FP-NEXT: lw s0, 8(sp) # 4-byte Folded Reload ; RV32I-WITH-FP-NEXT: .cfi_restore ra @@ -2924,6 +2933,7 @@ define void @varargs(...) { ; RV32IZCMP-WITH-FP-NEXT: sw a2, 8(s0) ; RV32IZCMP-WITH-FP-NEXT: sw a3, 12(s0) ; RV32IZCMP-WITH-FP-NEXT: call callee +; RV32IZCMP-WITH-FP-NEXT: .cfi_def_cfa sp, 48 ; RV32IZCMP-WITH-FP-NEXT: lw ra, 12(sp) # 4-byte Folded Reload ; RV32IZCMP-WITH-FP-NEXT: lw s0, 8(sp) # 4-byte Folded Reload ; RV32IZCMP-WITH-FP-NEXT: .cfi_restore ra @@ -2991,6 +3001,7 @@ define void @varargs(...) { ; RV64I-WITH-FP-NEXT: sd a2, 16(s0) ; RV64I-WITH-FP-NEXT: sd a3, 24(s0) ; RV64I-WITH-FP-NEXT: call callee +; RV64I-WITH-FP-NEXT: .cfi_def_cfa sp, 80 ; RV64I-WITH-FP-NEXT: ld ra, 8(sp) # 8-byte Folded Reload ; RV64I-WITH-FP-NEXT: ld s0, 0(sp) # 8-byte Folded Reload ; RV64I-WITH-FP-NEXT: .cfi_restore ra @@ -3039,6 +3050,7 @@ define void @varargs(...) { ; RV64IZCMP-WITH-FP-NEXT: sd a2, 16(s0) ; RV64IZCMP-WITH-FP-NEXT: sd a3, 24(s0) ; RV64IZCMP-WITH-FP-NEXT: call callee +; RV64IZCMP-WITH-FP-NEXT: .cfi_def_cfa sp, 80 ; RV64IZCMP-WITH-FP-NEXT: ld ra, 8(sp) # 8-byte Folded Reload ; RV64IZCMP-WITH-FP-NEXT: ld s0, 0(sp) # 8-byte Folded Reload ; RV64IZCMP-WITH-FP-NEXT: .cfi_restore ra diff --git a/llvm/test/CodeGen/RISCV/calling-conv-ilp32e.ll b/llvm/test/CodeGen/RISCV/calling-conv-ilp32e.ll index d726ac1915fc5b..4c2e64abd93521 100644 --- a/llvm/test/CodeGen/RISCV/calling-conv-ilp32e.ll +++ b/llvm/test/CodeGen/RISCV/calling-conv-ilp32e.ll @@ -49,6 +49,7 @@ define i32 @callee_float_in_regs(i32 %a, float %b) { ; ILP32E-WITHFP-NEXT: mv a0, a1 ; ILP32E-WITHFP-NEXT: call __fixsfsi ; ILP32E-WITHFP-NEXT: add a0, s1, a0 +; ILP32E-WITHFP-NEXT: .cfi_def_cfa sp, 12 ; ILP32E-WITHFP-NEXT: lw ra, 8(sp) # 4-byte Folded Reload ; ILP32E-WITHFP-NEXT: lw s0, 4(sp) # 4-byte Folded Reload ; ILP32E-WITHFP-NEXT: lw s1, 0(sp) # 4-byte Folded Reload @@ -84,6 +85,7 @@ define i32 @callee_float_in_regs(i32 %a, float %b) { ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: mv a0, a1 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: call __fixsfsi ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: add a0, s1, a0 +; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa sp, 12 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: tail __riscv_restore_2 %b_fptosi = fptosi float %b to i32 %1 = add i32 %a, %b_fptosi @@ -119,6 +121,7 @@ define i32 @caller_float_in_regs() { ; ILP32E-WITHFP-NEXT: li a0, 1 ; ILP32E-WITHFP-NEXT: lui a1, 262144 ; ILP32E-WITHFP-NEXT: call callee_float_in_regs +; ILP32E-WITHFP-NEXT: .cfi_def_cfa sp, 8 ; ILP32E-WITHFP-NEXT: lw ra, 4(sp) # 4-byte Folded Reload ; ILP32E-WITHFP-NEXT: lw s0, 0(sp) # 4-byte Folded Reload ; ILP32E-WITHFP-NEXT: .cfi_restore ra @@ -148,6 +151,7 @@ define i32 @caller_float_in_regs() { ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: li a0, 1 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: lui a1, 262144 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: call callee_float_in_regs +; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa sp, 8 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: tail __riscv_restore_1 %1 = call i32 @callee_float_in_regs(i32 1, float 2.0) ret i32 %1 @@ -174,6 +178,7 @@ define i32 @callee_float_on_stack(i64 %a, i64 %b, i64 %c, i64 %d, float %e) { ; ILP32E-WITHFP-NEXT: lw a0, 8(s0) ; ILP32E-WITHFP-NEXT: lw a1, 0(s0) ; ILP32E-WITHFP-NEXT: add a0, a1, a0 +; ILP32E-WITHFP-NEXT: .cfi_def_cfa sp, 8 ; ILP32E-WITHFP-NEXT: lw ra, 4(sp) # 4-byte Folded Reload ; ILP32E-WITHFP-NEXT: lw s0, 0(sp) # 4-byte Folded Reload ; ILP32E-WITHFP-NEXT: .cfi_restore ra @@ -200,6 +205,7 @@ define i32 @callee_float_on_stack(i64 %a, i64 %b, i64 %c, i64 %d, float %e) { ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: lw a0, 8(s0) ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: lw a1, 0(s0) ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: add a0, a1, a0 +; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa sp, 8 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: tail __riscv_restore_1 %1 = trunc i64 %d to i32 %2 = bitcast float %e to i32 @@ -254,6 +260,7 @@ define i32 @caller_float_on_stack() { ; ILP32E-WITHFP-NEXT: li a3, 0 ; ILP32E-WITHFP-NEXT: li a5, 0 ; ILP32E-WITHFP-NEXT: call callee_float_on_stack +; ILP32E-WITHFP-NEXT: .cfi_def_cfa sp, 20 ; ILP32E-WITHFP-NEXT: lw ra, 16(sp) # 4-byte Folded Reload ; ILP32E-WITHFP-NEXT: lw s0, 12(sp) # 4-byte Folded Reload ; ILP32E-WITHFP-NEXT: .cfi_restore ra @@ -305,6 +312,7 @@ define i32 @caller_float_on_stack() { ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: li a3, 0 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: li a5, 0 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: call callee_float_on_stack +; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa sp, 20 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: addi sp, sp, 12 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa_offset 8 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: tail __riscv_restore_1 @@ -329,6 +337,7 @@ define float @callee_tiny_scalar_ret() { ; ILP32E-WITHFP-NEXT: addi s0, sp, 8 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa s0, 0 ; ILP32E-WITHFP-NEXT: lui a0, 260096 +; ILP32E-WITHFP-NEXT: .cfi_def_cfa sp, 8 ; ILP32E-WITHFP-NEXT: lw ra, 4(sp) # 4-byte Folded Reload ; ILP32E-WITHFP-NEXT: lw s0, 0(sp) # 4-byte Folded Reload ; ILP32E-WITHFP-NEXT: .cfi_restore ra @@ -351,6 +360,7 @@ define float @callee_tiny_scalar_ret() { ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: addi s0, sp, 8 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa s0, 0 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: lui a0, 260096 +; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa sp, 8 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: tail __riscv_restore_1 ret float 1.0 } @@ -380,6 +390,7 @@ define i32 @caller_tiny_scalar_ret() { ; ILP32E-WITHFP-NEXT: addi s0, sp, 8 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa s0, 0 ; ILP32E-WITHFP-NEXT: call callee_tiny_scalar_ret +; ILP32E-WITHFP-NEXT: .cfi_def_cfa sp, 8 ; ILP32E-WITHFP-NEXT: lw ra, 4(sp) # 4-byte Folded Reload ; ILP32E-WITHFP-NEXT: lw s0, 0(sp) # 4-byte Folded Reload ; ILP32E-WITHFP-NEXT: .cfi_restore ra @@ -405,6 +416,7 @@ define i32 @caller_tiny_scalar_ret() { ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: addi s0, sp, 8 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa s0, 0 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: call callee_tiny_scalar_ret +; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa sp, 8 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: tail __riscv_restore_1 %1 = call float @callee_tiny_scalar_ret() %2 = bitcast float %1 to i32 @@ -453,6 +465,7 @@ define i32 @callee_double_in_regs(i32 %a, double %b) { ; ILP32E-WITHFP-NEXT: mv a1, a2 ; ILP32E-WITHFP-NEXT: call __fixdfsi ; ILP32E-WITHFP-NEXT: add a0, s1, a0 +; ILP32E-WITHFP-NEXT: .cfi_def_cfa sp, 12 ; ILP32E-WITHFP-NEXT: lw ra, 8(sp) # 4-byte Folded Reload ; ILP32E-WITHFP-NEXT: lw s0, 4(sp) # 4-byte Folded Reload ; ILP32E-WITHFP-NEXT: lw s1, 0(sp) # 4-byte Folded Reload @@ -490,6 +503,7 @@ define i32 @callee_double_in_regs(i32 %a, double %b) { ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: mv a1, a2 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: call __fixdfsi ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: add a0, s1, a0 +; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa sp, 12 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: tail __riscv_restore_2 %b_fptosi = fptosi double %b to i32 %1 = add i32 %a, %b_fptosi @@ -527,6 +541,7 @@ define i32 @caller_double_in_regs() { ; ILP32E-WITHFP-NEXT: lui a2, 262144 ; ILP32E-WITHFP-NEXT: li a1, 0 ; ILP32E-WITHFP-NEXT: call callee_double_in_regs +; ILP32E-WITHFP-NEXT: .cfi_def_cfa sp, 8 ; ILP32E-WITHFP-NEXT: lw ra, 4(sp) # 4-byte Folded Reload ; ILP32E-WITHFP-NEXT: lw s0, 0(sp) # 4-byte Folded Reload ; ILP32E-WITHFP-NEXT: .cfi_restore ra @@ -558,6 +573,7 @@ define i32 @caller_double_in_regs() { ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: lui a2, 262144 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: li a1, 0 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: call callee_double_in_regs +; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa sp, 8 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: tail __riscv_restore_1 %1 = call i32 @callee_double_in_regs(i32 1, double 2.0) ret i32 %1 @@ -604,6 +620,7 @@ define i32 @callee_aligned_stack(i32 %a, i32 %b, fp128 %c, i32 %d, i32 %e, i64 % ; ILP32E-WITHFP-NEXT: add a0, a0, a1 ; ILP32E-WITHFP-NEXT: add a4, a5, a4 ; ILP32E-WITHFP-NEXT: add a0, a0, a4 +; ILP32E-WITHFP-NEXT: .cfi_def_cfa sp, 8 ; ILP32E-WITHFP-NEXT: lw ra, 4(sp) # 4-byte Folded Reload ; ILP32E-WITHFP-NEXT: lw s0, 0(sp) # 4-byte Folded Reload ; ILP32E-WITHFP-NEXT: .cfi_restore ra @@ -646,6 +663,7 @@ define i32 @callee_aligned_stack(i32 %a, i32 %b, fp128 %c, i32 %d, i32 %e, i64 % ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: add a0, a0, a1 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: add a4, a5, a4 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: add a0, a0, a4 +; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa sp, 8 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: tail __riscv_restore_1 %1 = bitcast fp128 %c to i128 %2 = trunc i128 %1 to i32 @@ -914,6 +932,7 @@ define double @callee_small_scalar_ret() { ; ILP32E-WITHFP-NEXT: .cfi_def_cfa s0, 0 ; ILP32E-WITHFP-NEXT: lui a1, 261888 ; ILP32E-WITHFP-NEXT: li a0, 0 +; ILP32E-WITHFP-NEXT: .cfi_def_cfa sp, 8 ; ILP32E-WITHFP-NEXT: lw ra, 4(sp) # 4-byte Folded Reload ; ILP32E-WITHFP-NEXT: lw s0, 0(sp) # 4-byte Folded Reload ; ILP32E-WITHFP-NEXT: .cfi_restore ra @@ -938,6 +957,7 @@ define double @callee_small_scalar_ret() { ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa s0, 0 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: lui a1, 261888 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: li a0, 0 +; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa sp, 8 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: tail __riscv_restore_1 ret double 1.0 } @@ -967,6 +987,7 @@ define i64 @caller_small_scalar_ret() { ; ILP32E-WITHFP-NEXT: addi s0, sp, 8 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa s0, 0 ; ILP32E-WITHFP-NEXT: call callee_small_scalar_ret +; ILP32E-WITHFP-NEXT: .cfi_def_cfa sp, 8 ; ILP32E-WITHFP-NEXT: lw ra, 4(sp) # 4-byte Folded Reload ; ILP32E-WITHFP-NEXT: lw s0, 0(sp) # 4-byte Folded Reload ; ILP32E-WITHFP-NEXT: .cfi_restore ra @@ -992,6 +1013,7 @@ define i64 @caller_small_scalar_ret() { ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: addi s0, sp, 8 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa s0, 0 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: call callee_small_scalar_ret +; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa sp, 8 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: tail __riscv_restore_1 %1 = call double @callee_small_scalar_ret() %2 = bitcast double %1 to i64 @@ -1018,6 +1040,7 @@ define i32 @callee_i64_in_regs(i32 %a, i64 %b) { ; ILP32E-WITHFP-NEXT: addi s0, sp, 8 ; ILP32E-WITHFP-NEXT: .cfi_def_cfa s0, 0 ; ILP32E-WITHFP-NEXT: add a0, a0, a1 +; ILP32E-WITHFP-NEXT: .cfi_def_cfa sp, 8 ; ILP32E-WITHFP-NEXT: lw ra, 4(sp) # 4-byte Folded Reload ; ILP32E-WITHFP-NEXT: lw s0, 0(sp) # 4-byte Folded Reload ; ILP32E-WITHFP-NEXT: .cfi_restore ra @@ -1040,6 +1063,7 @@ define i32 @callee_i64_in_regs(i32 %a, i64 %b) { ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: addi s0, sp, 8 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa s0, 0 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: add a0, a0, a1 +; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa sp, 8 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: tail __riscv_restore_1 %b_trunc = trunc i64 %b to i32 %1 = add i32 %a, %b_trunc @@ -1077,6 +1101,7 @@ define i32 @caller_i64_in_regs() { ; ILP32E-WITHFP-NEXT: li a1, 2 ; ILP32E-WITHFP-NEXT: li a2, 0 ; ILP32E-WITHFP-NEXT: call callee_i64_in_regs +; ILP32E-WITHFP-NEXT: .cfi_def_cfa sp, 8 ; ILP32E-WITHFP-NEXT: lw ra, 4(sp) # 4-byte Folded Reload ; ILP32E-WITHFP-NEXT: lw s0, 0(sp) # 4-byte Folded Reload ; ILP32E-WITHFP-NEXT: .cfi_restore ra @@ -1108,6 +1133,7 @@ define i32 @caller_i64_in_regs() { ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: li a1, 2 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: li a2, 0 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: call callee_i64_in_regs +; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa sp, 8 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: tail __riscv_restore_1 %1 = call i32 @callee_i64_in_regs(i32 1, i64 2) ret i32 %1 @@ -1164,6 +1190,7 @@ define i32 @callee_many_scalars(i8 %a, i16 %b, i32 %c, i64 %d, i32 %e, i32 %f, i ; ILP32E-WITHFP-NEXT: add a0, a0, a7 ; ILP32E-WITHFP-NEXT: add a0, a0, a6 ; ILP32E-WITHFP-NEXT: add a0, a1, a0 +; ILP32E-WITHFP-NEXT: .cfi_def_cfa sp, 8 ; ILP32E-WITHFP-NEXT: lw ra, 4(sp) # 4-byte Folded Reload ; ILP32E-WITHFP-NEXT: lw s0, 0(sp) # 4-byte Folded Reload ; ILP32E-WITHFP-NEXT: .cfi_restore ra @@ -1218,6 +1245,7 @@ define i32 @callee_many_scalars(i8 %a, i16 %b, i32 %c, i64 %d, i32 %e, i32 %f, i ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: add a0, a0, a7 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: add a0, a0, a6 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: add a0, a1, a0 +; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa sp, 8 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: tail __riscv_restore_1 %a_ext = zext i8 %a to i32 %b_ext = zext i16 %b to i32 @@ -1283,6 +1311,7 @@ define i32 @caller_many_scalars() { ; ILP32E-WITHFP-NEXT: sw a4, 12(sp) ; ILP32E-WITHFP-NEXT: li a4, 0 ; ILP32E-WITHFP-NEXT: call callee_many_scalars +; ILP32E-WITHFP-NEXT: .cfi_def_cfa sp, 24 ; ILP32E-WITHFP-NEXT: lw ra, 20(sp) # 4-byte Folded Reload ; ILP32E-WITHFP-NEXT: lw s0, 16(sp) # 4-byte Folded Reload ; ILP32E-WITHFP-NEXT: .cfi_restore ra @@ -1338,6 +1367,7 @@ define i32 @caller_many_scalars() { ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: sw a4, 12(sp) ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: li a4, 0 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: call callee_many_scalars +; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa sp, 24 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: addi sp, sp, 16 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa_offset 8 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: tail __riscv_restore_1 @@ -1394,6 +1424,7 @@ define i32 @callee_large_scalars(i128 %a, fp128 %b) { ; ILP32E-WITHFP-NEXT: or a0, a1, a0 ; ILP32E-WITHFP-NEXT: or a0, a0, a3 ; ILP32E-WITHFP-NEXT: seqz a0, a0 +; ILP32E-WITHFP-NEXT: .cfi_def_cfa sp, 8 ; ILP32E-WITHFP-NEXT: lw ra, 4(sp) # 4-byte Folded Reload ; ILP32E-WITHFP-NEXT: lw s0, 0(sp) # 4-byte Folded Reload ; ILP32E-WITHFP-NEXT: .cfi_restore ra @@ -1446,6 +1477,7 @@ define i32 @callee_large_scalars(i128 %a, fp128 %b) { ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: or a0, a1, a0 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: or a0, a0, a3 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: seqz a0, a0 +; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa sp, 8 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: tail __riscv_restore_1 %b_bitcast = bitcast fp128 %b to i128 %1 = icmp eq i128 %a, %b_bitcast @@ -1638,6 +1670,7 @@ define i32 @callee_large_scalars_exhausted_regs(i32 %a, i32 %b, i32 %c, i32 %d, ; ILP32E-WITHFP-NEXT: or a0, a1, a0 ; ILP32E-WITHFP-NEXT: or a0, a0, a3 ; ILP32E-WITHFP-NEXT: seqz a0, a0 +; ILP32E-WITHFP-NEXT: .cfi_def_cfa sp, 8 ; ILP32E-WITHFP-NEXT: lw ra, 4(sp) # 4-byte Folded Reload ; ILP32E-WITHFP-NEXT: lw s0, 0(sp) # 4-byte Folded Reload ; ILP32E-WITHFP-NEXT: .cfi_restore ra @@ -1694,6 +1727,7 @@ define i32 @callee_large_scalars_exhausted_regs(i32 %a, i32 %b, i32 %c, i32 %d, ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: or a0, a1, a0 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: or a0, a0, a3 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: seqz a0, a0 +; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa sp, 8 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: tail __riscv_restore_1 %j_bitcast = bitcast fp128 %j to i128 %1 = icmp eq i128 %h, %j_bitcast @@ -2007,6 +2041,7 @@ define i32 @callee_small_coerced_struct([2 x i32] %a.coerce) { ; ILP32E-WITHFP-NEXT: .cfi_def_cfa s0, 0 ; ILP32E-WITHFP-NEXT: xor a0, a0, a1 ; ILP32E-WITHFP-NEXT: seqz a0, a0 +; ILP32E-WITHFP-NEXT: .cfi_def_cfa sp, 8 ; ILP32E-WITHFP-NEXT: lw ra, 4(sp) # 4-byte Folded Reload ; ILP32E-WITHFP-NEXT: lw s0, 0(sp) # 4-byte Folded Reload ; ILP32E-WITHFP-NEXT: .cfi_restore ra @@ -2031,6 +2066,7 @@ define i32 @callee_small_coerced_struct([2 x i32] %a.coerce) { ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa s0, 0 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: xor a0, a0, a1 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: seqz a0, a0 +; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa sp, 8 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: tail __riscv_restore_1 %1 = extractvalue [2 x i32] %a.coerce, 0 %2 = extractvalue [2 x i32] %a.coerce, 1 @@ -2068,6 +2104,7 @@ define i32 @caller_small_coerced_struct() { ; ILP32E-WITHFP-NEXT: li a0, 1 ; ILP32E-WITHFP-NEXT: li a1, 2 ; ILP32E-WITHFP-NEXT: call callee_small_coerced_struct +; ILP32E-WITHFP-NEXT: .cfi_def_cfa sp, 8 ; ILP32E-WITHFP-NEXT: lw ra, 4(sp) # 4-byte Folded Reload ; ILP32E-WITHFP-NEXT: lw s0, 0(sp) # 4-byte Folded Reload ; ILP32E-WITHFP-NEXT: .cfi_restore ra @@ -2097,6 +2134,7 @@ define i32 @caller_small_coerced_struct() { ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: li a0, 1 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: li a1, 2 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: call callee_small_coerced_struct +; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa sp, 8 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: tail __riscv_restore_1 %1 = call i32 @callee_small_coerced_struct([2 x i32] [i32 1, i32 2]) ret i32 %1 @@ -2127,6 +2165,7 @@ define i32 @callee_large_struct(ptr byval(%struct.large) align 4 %a) { ; ILP32E-WITHFP-NEXT: lw a1, 0(a0) ; ILP32E-WITHFP-NEXT: lw a0, 12(a0) ; ILP32E-WITHFP-NEXT: add a0, a1, a0 +; ILP32E-WITHFP-NEXT: .cfi_def_cfa sp, 8 ; ILP32E-WITHFP-NEXT: lw ra, 4(sp) # 4-byte Folded Reload ; ILP32E-WITHFP-NEXT: lw s0, 0(sp) # 4-byte Folded Reload ; ILP32E-WITHFP-NEXT: .cfi_restore ra @@ -2153,6 +2192,7 @@ define i32 @callee_large_struct(ptr byval(%struct.large) align 4 %a) { ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: lw a1, 0(a0) ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: lw a0, 12(a0) ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: add a0, a1, a0 +; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa sp, 8 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: tail __riscv_restore_1 %1 = getelementptr inbounds %struct.large, ptr %a, i32 0, i32 0 %2 = getelementptr inbounds %struct.large, ptr %a, i32 0, i32 3 @@ -2213,6 +2253,7 @@ define i32 @caller_large_struct() { ; ILP32E-WITHFP-NEXT: sw a3, -28(s0) ; ILP32E-WITHFP-NEXT: addi a0, s0, -40 ; ILP32E-WITHFP-NEXT: call callee_large_struct +; ILP32E-WITHFP-NEXT: .cfi_def_cfa sp, 40 ; ILP32E-WITHFP-NEXT: lw ra, 36(sp) # 4-byte Folded Reload ; ILP32E-WITHFP-NEXT: lw s0, 32(sp) # 4-byte Folded Reload ; ILP32E-WITHFP-NEXT: .cfi_restore ra @@ -2268,6 +2309,7 @@ define i32 @caller_large_struct() { ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: sw a3, -28(s0) ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: addi a0, s0, -40 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: call callee_large_struct +; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa sp, 40 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: addi sp, sp, 32 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa_offset 8 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: tail __riscv_restore_1 @@ -2306,6 +2348,7 @@ define %struct.small @callee_small_struct_ret() { ; ILP32E-WITHFP-NEXT: .cfi_def_cfa s0, 0 ; ILP32E-WITHFP-NEXT: li a0, 1 ; ILP32E-WITHFP-NEXT: li a1, 0 +; ILP32E-WITHFP-NEXT: .cfi_def_cfa sp, 8 ; ILP32E-WITHFP-NEXT: lw ra, 4(sp) # 4-byte Folded Reload ; ILP32E-WITHFP-NEXT: lw s0, 0(sp) # 4-byte Folded Reload ; ILP32E-WITHFP-NEXT: .cfi_restore ra @@ -2330,6 +2373,7 @@ define %struct.small @callee_small_struct_ret() { ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa s0, 0 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: li a0, 1 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: li a1, 0 +; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa sp, 8 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: tail __riscv_restore_1 ret %struct.small { i32 1, ptr null } } @@ -2361,6 +2405,7 @@ define i32 @caller_small_struct_ret() { ; ILP32E-WITHFP-NEXT: .cfi_def_cfa s0, 0 ; ILP32E-WITHFP-NEXT: call callee_small_struct_ret ; ILP32E-WITHFP-NEXT: add a0, a0, a1 +; ILP32E-WITHFP-NEXT: .cfi_def_cfa sp, 8 ; ILP32E-WITHFP-NEXT: lw ra, 4(sp) # 4-byte Folded Reload ; ILP32E-WITHFP-NEXT: lw s0, 0(sp) # 4-byte Folded Reload ; ILP32E-WITHFP-NEXT: .cfi_restore ra @@ -2388,6 +2433,7 @@ define i32 @caller_small_struct_ret() { ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa s0, 0 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: call callee_small_struct_ret ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: add a0, a0, a1 +; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa sp, 8 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: tail __riscv_restore_1 %1 = call %struct.small @callee_small_struct_ret() %2 = extractvalue %struct.small %1, 0 @@ -2424,6 +2470,7 @@ define fp128 @callee_large_scalar_ret() { ; ILP32E-WITHFP-NEXT: sw zero, 4(a0) ; ILP32E-WITHFP-NEXT: sw zero, 8(a0) ; ILP32E-WITHFP-NEXT: sw a1, 12(a0) +; ILP32E-WITHFP-NEXT: .cfi_def_cfa sp, 8 ; ILP32E-WITHFP-NEXT: lw ra, 4(sp) # 4-byte Folded Reload ; ILP32E-WITHFP-NEXT: lw s0, 0(sp) # 4-byte Folded Reload ; ILP32E-WITHFP-NEXT: .cfi_restore ra @@ -2454,6 +2501,7 @@ define fp128 @callee_large_scalar_ret() { ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: sw zero, 4(a0) ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: sw zero, 8(a0) ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: sw a1, 12(a0) +; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa sp, 8 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: tail __riscv_restore_1 ret fp128 0xL00000000000000007FFF000000000000 } @@ -2577,6 +2625,7 @@ define void @callee_large_struct_ret(ptr noalias sret(%struct.large) %agg.result ; ILP32E-WITHFP-NEXT: sw a2, 4(a0) ; ILP32E-WITHFP-NEXT: sw a3, 8(a0) ; ILP32E-WITHFP-NEXT: sw a4, 12(a0) +; ILP32E-WITHFP-NEXT: .cfi_def_cfa sp, 8 ; ILP32E-WITHFP-NEXT: lw ra, 4(sp) # 4-byte Folded Reload ; ILP32E-WITHFP-NEXT: lw s0, 0(sp) # 4-byte Folded Reload ; ILP32E-WITHFP-NEXT: .cfi_restore ra @@ -2613,6 +2662,7 @@ define void @callee_large_struct_ret(ptr noalias sret(%struct.large) %agg.result ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: sw a2, 4(a0) ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: sw a3, 8(a0) ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: sw a4, 12(a0) +; ILP32E-WITHFP-SAVE-RESTORE-NEXT: .cfi_def_cfa sp, 8 ; ILP32E-WITHFP-SAVE-RESTORE-NEXT: tail __riscv_restore_1 %a = getelementptr inbounds %struct.large, ptr %agg.result, i32 0, i32 0 store i32 1, ptr %a, align 4 diff --git a/llvm/test/CodeGen/RISCV/frame-info.ll b/llvm/test/CodeGen/RISCV/frame-info.ll index f89b0f908a1cbb..4979c9f75ef94d 100644 --- a/llvm/test/CodeGen/RISCV/frame-info.ll +++ b/llvm/test/CodeGen/RISCV/frame-info.ll @@ -36,6 +36,7 @@ define void @trivial() { ; RV32-WITHFP-NEXT: .cfi_offset s0, -8 ; RV32-WITHFP-NEXT: addi s0, sp, 16 ; RV32-WITHFP-NEXT: .cfi_def_cfa s0, 0 +; RV32-WITHFP-NEXT: .cfi_def_cfa sp, 16 ; RV32-WITHFP-NEXT: lw ra, 12(sp) # 4-byte Folded Reload ; RV32-WITHFP-NEXT: lw s0, 8(sp) # 4-byte Folded Reload ; RV32-WITHFP-NEXT: .cfi_restore ra @@ -54,6 +55,7 @@ define void @trivial() { ; RV64-WITHFP-NEXT: .cfi_offset s0, -16 ; RV64-WITHFP-NEXT: addi s0, sp, 16 ; RV64-WITHFP-NEXT: .cfi_def_cfa s0, 0 +; RV64-WITHFP-NEXT: .cfi_def_cfa sp, 16 ; RV64-WITHFP-NEXT: ld ra, 8(sp) # 8-byte Folded Reload ; RV64-WITHFP-NEXT: ld s0, 0(sp) # 8-byte Folded Reload ; RV64-WITHFP-NEXT: .cfi_restore ra @@ -80,6 +82,7 @@ define void @trivial() { ; RV32-WITHFP-DISABLESW-NEXT: .cfi_offset s0, -8 ; RV32-WITHFP-DISABLESW-NEXT: addi s0, sp, 16 ; RV32-WITHFP-DISABLESW-NEXT: .cfi_def_cfa s0, 0 +; RV32-WITHFP-DISABLESW-NEXT: .cfi_def_cfa sp, 16 ; RV32-WITHFP-DISABLESW-NEXT: lw ra, 12(sp) # 4-byte Folded Reload ; RV32-WITHFP-DISABLESW-NEXT: lw s0, 8(sp) # 4-byte Folded Reload ; RV32-WITHFP-DISABLESW-NEXT: .cfi_restore ra @@ -98,6 +101,7 @@ define void @trivial() { ; RV64-WITHFP-DISABLESW-NEXT: .cfi_offset s0, -16 ; RV64-WITHFP-DISABLESW-NEXT: addi s0, sp, 16 ; RV64-WITHFP-DISABLESW-NEXT: .cfi_def_cfa s0, 0 +; RV64-WITHFP-DISABLESW-NEXT: .cfi_def_cfa sp, 16 ; RV64-WITHFP-DISABLESW-NEXT: ld ra, 8(sp) # 8-byte Folded Reload ; RV64-WITHFP-DISABLESW-NEXT: ld s0, 0(sp) # 8-byte Folded Reload ; RV64-WITHFP-DISABLESW-NEXT: .cfi_restore ra @@ -375,6 +379,7 @@ define void @branch_and_tail_call(i1 %a) { ; RV32-WITHFP-NEXT: addi s0, sp, 16 ; RV32-WITHFP-NEXT: .cfi_def_cfa s0, 0 ; RV32-WITHFP-NEXT: call callee2 +; RV32-WITHFP-NEXT: .cfi_def_cfa sp, 16 ; RV32-WITHFP-NEXT: lw ra, 12(sp) # 4-byte Folded Reload ; RV32-WITHFP-NEXT: lw s0, 8(sp) # 4-byte Folded Reload ; RV32-WITHFP-NEXT: .cfi_restore ra @@ -399,6 +404,7 @@ define void @branch_and_tail_call(i1 %a) { ; RV64-WITHFP-NEXT: addi s0, sp, 16 ; RV64-WITHFP-NEXT: .cfi_def_cfa s0, 0 ; RV64-WITHFP-NEXT: call callee2 +; RV64-WITHFP-NEXT: .cfi_def_cfa sp, 16 ; RV64-WITHFP-NEXT: ld ra, 8(sp) # 8-byte Folded Reload ; RV64-WITHFP-NEXT: ld s0, 0(sp) # 8-byte Folded Reload ; RV64-WITHFP-NEXT: .cfi_restore ra @@ -469,6 +475,7 @@ define void @branch_and_tail_call(i1 %a) { ; RV32-WITHFP-DISABLESW-NEXT: andi a0, a0, 1 ; RV32-WITHFP-DISABLESW-NEXT: beqz a0, .LBB2_2 ; RV32-WITHFP-DISABLESW-NEXT: # %bb.1: # %blue_pill +; RV32-WITHFP-DISABLESW-NEXT: .cfi_def_cfa sp, 16 ; RV32-WITHFP-DISABLESW-NEXT: lw ra, 12(sp) # 4-byte Folded Reload ; RV32-WITHFP-DISABLESW-NEXT: lw s0, 8(sp) # 4-byte Folded Reload ; RV32-WITHFP-DISABLESW-NEXT: .cfi_restore ra @@ -479,6 +486,7 @@ define void @branch_and_tail_call(i1 %a) { ; RV32-WITHFP-DISABLESW-NEXT: .LBB2_2: # %red_pill ; RV32-WITHFP-DISABLESW-NEXT: .cfi_restore_state ; RV32-WITHFP-DISABLESW-NEXT: call callee2 +; RV32-WITHFP-DISABLESW-NEXT: .cfi_def_cfa sp, 16 ; RV32-WITHFP-DISABLESW-NEXT: lw ra, 12(sp) # 4-byte Folded Reload ; RV32-WITHFP-DISABLESW-NEXT: lw s0, 8(sp) # 4-byte Folded Reload ; RV32-WITHFP-DISABLESW-NEXT: .cfi_restore ra @@ -501,6 +509,7 @@ define void @branch_and_tail_call(i1 %a) { ; RV64-WITHFP-DISABLESW-NEXT: andi a0, a0, 1 ; RV64-WITHFP-DISABLESW-NEXT: beqz a0, .LBB2_2 ; RV64-WITHFP-DISABLESW-NEXT: # %bb.1: # %blue_pill +; RV64-WITHFP-DISABLESW-NEXT: .cfi_def_cfa sp, 16 ; RV64-WITHFP-DISABLESW-NEXT: ld ra, 8(sp) # 8-byte Folded Reload ; RV64-WITHFP-DISABLESW-NEXT: ld s0, 0(sp) # 8-byte Folded Reload ; RV64-WITHFP-DISABLESW-NEXT: .cfi_restore ra @@ -511,6 +520,7 @@ define void @branch_and_tail_call(i1 %a) { ; RV64-WITHFP-DISABLESW-NEXT: .LBB2_2: # %red_pill ; RV64-WITHFP-DISABLESW-NEXT: .cfi_restore_state ; RV64-WITHFP-DISABLESW-NEXT: call callee2 +; RV64-WITHFP-DISABLESW-NEXT: .cfi_def_cfa sp, 16 ; RV64-WITHFP-DISABLESW-NEXT: ld ra, 8(sp) # 8-byte Folded Reload ; RV64-WITHFP-DISABLESW-NEXT: ld s0, 0(sp) # 8-byte Folded Reload ; RV64-WITHFP-DISABLESW-NEXT: .cfi_restore ra diff --git a/llvm/test/CodeGen/RISCV/large-stack.ll b/llvm/test/CodeGen/RISCV/large-stack.ll index 1db33821c1e188..812f5837f951f7 100644 --- a/llvm/test/CodeGen/RISCV/large-stack.ll +++ b/llvm/test/CodeGen/RISCV/large-stack.ll @@ -35,7 +35,7 @@ define void @test() { ; RV32I-WITHFP-NEXT: lui a0, 74565 ; RV32I-WITHFP-NEXT: addi a0, a0, -352 ; RV32I-WITHFP-NEXT: add sp, sp, a0 -; RV32I-WITHFP-NEXT: .cfi_def_cfa_offset 2032 +; RV32I-WITHFP-NEXT: .cfi_def_cfa sp, 2032 ; RV32I-WITHFP-NEXT: lw ra, 2028(sp) # 4-byte Folded Reload ; RV32I-WITHFP-NEXT: lw s0, 2024(sp) # 4-byte Folded Reload ; RV32I-WITHFP-NEXT: .cfi_restore ra @@ -117,7 +117,7 @@ define void @test_emergency_spill_slot(i32 %a) { ; RV32I-WITHFP-NEXT: lui a0, 97 ; RV32I-WITHFP-NEXT: addi a0, a0, 688 ; RV32I-WITHFP-NEXT: add sp, sp, a0 -; RV32I-WITHFP-NEXT: .cfi_def_cfa_offset 2032 +; RV32I-WITHFP-NEXT: .cfi_def_cfa sp, 2032 ; RV32I-WITHFP-NEXT: lw ra, 2028(sp) # 4-byte Folded Reload ; RV32I-WITHFP-NEXT: lw s0, 2024(sp) # 4-byte Folded Reload ; RV32I-WITHFP-NEXT: lw s1, 2020(sp) # 4-byte Folded Reload diff --git a/llvm/test/CodeGen/RISCV/local-stack-slot-allocation.ll b/llvm/test/CodeGen/RISCV/local-stack-slot-allocation.ll index a6eb5795c99307..3c83f5f91b37cb 100644 --- a/llvm/test/CodeGen/RISCV/local-stack-slot-allocation.ll +++ b/llvm/test/CodeGen/RISCV/local-stack-slot-allocation.ll @@ -133,7 +133,7 @@ define void @frame_pointer() "frame-pointer"="all" { ; RV32I-NEXT: lbu a0, -1960(s0) ; RV32I-NEXT: sb a0, -1960(s0) ; RV32I-NEXT: addi sp, sp, 480 -; RV32I-NEXT: .cfi_def_cfa_offset 2032 +; RV32I-NEXT: .cfi_def_cfa sp, 2032 ; RV32I-NEXT: lw ra, 2028(sp) # 4-byte Folded Reload ; RV32I-NEXT: lw s0, 2024(sp) # 4-byte Folded Reload ; RV32I-NEXT: .cfi_restore ra @@ -157,7 +157,7 @@ define void @frame_pointer() "frame-pointer"="all" { ; RV64I-NEXT: lbu a1, 0(a0) ; RV64I-NEXT: sb a1, 0(a0) ; RV64I-NEXT: addi sp, sp, 496 -; RV64I-NEXT: .cfi_def_cfa_offset 2032 +; RV64I-NEXT: .cfi_def_cfa sp, 2032 ; RV64I-NEXT: ld ra, 2024(sp) # 8-byte Folded Reload ; RV64I-NEXT: ld s0, 2016(sp) # 8-byte Folded Reload ; RV64I-NEXT: .cfi_restore ra diff --git a/llvm/test/CodeGen/RISCV/push-pop-popret.ll b/llvm/test/CodeGen/RISCV/push-pop-popret.ll index c131552588173d..f45905af91dec5 100644 --- a/llvm/test/CodeGen/RISCV/push-pop-popret.ll +++ b/llvm/test/CodeGen/RISCV/push-pop-popret.ll @@ -3369,6 +3369,7 @@ define i32 @use_fp(i32 %x) { ; RV32IZCMP-NEXT: mv a0, s0 ; RV32IZCMP-NEXT: call bar ; RV32IZCMP-NEXT: mv a0, s1 +; RV32IZCMP-NEXT: .cfi_def_cfa sp, 32 ; RV32IZCMP-NEXT: cm.pop {ra, s0-s1}, 32 ; RV32IZCMP-NEXT: .cfi_def_cfa_offset 0 ; RV32IZCMP-NEXT: .cfi_restore ra @@ -3390,6 +3391,7 @@ define i32 @use_fp(i32 %x) { ; RV64IZCMP-NEXT: mv a0, s0 ; RV64IZCMP-NEXT: call bar ; RV64IZCMP-NEXT: mv a0, s1 +; RV64IZCMP-NEXT: .cfi_def_cfa sp, 48 ; RV64IZCMP-NEXT: cm.pop {ra, s0-s1}, 48 ; RV64IZCMP-NEXT: .cfi_def_cfa_offset 0 ; RV64IZCMP-NEXT: .cfi_restore ra @@ -3411,6 +3413,7 @@ define i32 @use_fp(i32 %x) { ; RV32IZCMP-SR-NEXT: mv a0, s0 ; RV32IZCMP-SR-NEXT: call bar ; RV32IZCMP-SR-NEXT: mv a0, s1 +; RV32IZCMP-SR-NEXT: .cfi_def_cfa sp, 32 ; RV32IZCMP-SR-NEXT: cm.pop {ra, s0-s1}, 32 ; RV32IZCMP-SR-NEXT: .cfi_def_cfa_offset 0 ; RV32IZCMP-SR-NEXT: .cfi_restore ra @@ -3432,6 +3435,7 @@ define i32 @use_fp(i32 %x) { ; RV64IZCMP-SR-NEXT: mv a0, s0 ; RV64IZCMP-SR-NEXT: call bar ; RV64IZCMP-SR-NEXT: mv a0, s1 +; RV64IZCMP-SR-NEXT: .cfi_def_cfa sp, 48 ; RV64IZCMP-SR-NEXT: cm.pop {ra, s0-s1}, 48 ; RV64IZCMP-SR-NEXT: .cfi_def_cfa_offset 0 ; RV64IZCMP-SR-NEXT: .cfi_restore ra @@ -3456,6 +3460,7 @@ define i32 @use_fp(i32 %x) { ; RV32I-NEXT: mv a0, s0 ; RV32I-NEXT: call bar ; RV32I-NEXT: mv a0, s1 +; RV32I-NEXT: .cfi_def_cfa sp, 16 ; RV32I-NEXT: lw ra, 12(sp) # 4-byte Folded Reload ; RV32I-NEXT: lw s0, 8(sp) # 4-byte Folded Reload ; RV32I-NEXT: lw s1, 4(sp) # 4-byte Folded Reload @@ -3483,6 +3488,7 @@ define i32 @use_fp(i32 %x) { ; RV64I-NEXT: mv a0, s0 ; RV64I-NEXT: call bar ; RV64I-NEXT: mv a0, s1 +; RV64I-NEXT: .cfi_def_cfa sp, 32 ; RV64I-NEXT: ld ra, 24(sp) # 8-byte Folded Reload ; RV64I-NEXT: ld s0, 16(sp) # 8-byte Folded Reload ; RV64I-NEXT: ld s1, 8(sp) # 8-byte Folded Reload diff --git a/llvm/test/CodeGen/RISCV/vararg-ilp32e.ll b/llvm/test/CodeGen/RISCV/vararg-ilp32e.ll index 6600a65144ea4a..281c19dc09712f 100644 --- a/llvm/test/CodeGen/RISCV/vararg-ilp32e.ll +++ b/llvm/test/CodeGen/RISCV/vararg-ilp32e.ll @@ -49,6 +49,7 @@ define i32 @caller(i32 %a) { ; ILP32E-WITHFP-NEXT: li a1, 0 ; ILP32E-WITHFP-NEXT: call va_double ; ILP32E-WITHFP-NEXT: mv a0, s1 +; ILP32E-WITHFP-NEXT: .cfi_def_cfa sp, 12 ; ILP32E-WITHFP-NEXT: lw ra, 8(sp) # 4-byte Folded Reload ; ILP32E-WITHFP-NEXT: lw s0, 4(sp) # 4-byte Folded Reload ; ILP32E-WITHFP-NEXT: lw s1, 0(sp) # 4-byte Folded Reload @@ -127,6 +128,7 @@ define void @va_double(i32 %n, ...) { ; ILP32E-WITHFP-NEXT: call __eqdf2 ; ILP32E-WITHFP-NEXT: bnez a0, .LBB1_2 ; ILP32E-WITHFP-NEXT: # %bb.1: # %if.end +; ILP32E-WITHFP-NEXT: .cfi_def_cfa sp, 36 ; ILP32E-WITHFP-NEXT: lw ra, 8(sp) # 4-byte Folded Reload ; ILP32E-WITHFP-NEXT: lw s0, 4(sp) # 4-byte Folded Reload ; ILP32E-WITHFP-NEXT: .cfi_restore ra diff --git a/llvm/test/CodeGen/RISCV/vararg.ll b/llvm/test/CodeGen/RISCV/vararg.ll index 164ea498e5d24d..318b6973b724e6 100644 --- a/llvm/test/CodeGen/RISCV/vararg.ll +++ b/llvm/test/CodeGen/RISCV/vararg.ll @@ -88,6 +88,7 @@ define i32 @va1(ptr %fmt, ...) { ; ILP32-ILP32F-WITHFP-NEXT: sw a4, 16(s0) ; ILP32-ILP32F-WITHFP-NEXT: addi a1, s0, 8 ; ILP32-ILP32F-WITHFP-NEXT: sw a1, -12(s0) +; ILP32-ILP32F-WITHFP-NEXT: .cfi_def_cfa sp, 48 ; ILP32-ILP32F-WITHFP-NEXT: lw ra, 12(sp) # 4-byte Folded Reload ; ILP32-ILP32F-WITHFP-NEXT: lw s0, 8(sp) # 4-byte Folded Reload ; ILP32-ILP32F-WITHFP-NEXT: .cfi_restore ra @@ -148,6 +149,7 @@ define i32 @va1(ptr %fmt, ...) { ; ILP32E-WITHFP-NEXT: sw a4, 16(s0) ; ILP32E-WITHFP-NEXT: addi a1, s0, 8 ; ILP32E-WITHFP-NEXT: sw a1, -12(s0) +; ILP32E-WITHFP-NEXT: .cfi_def_cfa sp, 36 ; ILP32E-WITHFP-NEXT: lw ra, 8(sp) # 4-byte Folded Reload ; ILP32E-WITHFP-NEXT: lw s0, 4(sp) # 4-byte Folded Reload ; ILP32E-WITHFP-NEXT: .cfi_restore ra @@ -194,6 +196,7 @@ define i32 @va1(ptr %fmt, ...) { ; LP64-LP64F-LP64D-WITHFP-NEXT: sd a2, 16(s0) ; LP64-LP64F-LP64D-WITHFP-NEXT: sd a3, 24(s0) ; LP64-LP64F-LP64D-WITHFP-NEXT: sd a4, 32(s0) +; LP64-LP64F-LP64D-WITHFP-NEXT: .cfi_def_cfa sp, 96 ; LP64-LP64F-LP64D-WITHFP-NEXT: ld ra, 24(sp) # 8-byte Folded Reload ; LP64-LP64F-LP64D-WITHFP-NEXT: ld s0, 16(sp) # 8-byte Folded Reload ; LP64-LP64F-LP64D-WITHFP-NEXT: .cfi_restore ra @@ -236,6 +239,7 @@ define i32 @va1(ptr %fmt, ...) { ; LP64E-WITHFP-NEXT: sd a2, 16(s0) ; LP64E-WITHFP-NEXT: sd a3, 24(s0) ; LP64E-WITHFP-NEXT: sd a4, 32(s0) +; LP64E-WITHFP-NEXT: .cfi_def_cfa sp, 72 ; LP64E-WITHFP-NEXT: ld ra, 16(sp) # 8-byte Folded Reload ; LP64E-WITHFP-NEXT: ld s0, 8(sp) # 8-byte Folded Reload ; LP64E-WITHFP-NEXT: .cfi_restore ra @@ -2868,7 +2872,7 @@ define i32 @va_large_stack(ptr %fmt, ...) { ; ILP32-ILP32F-WITHFP-NEXT: lui a1, 24414 ; ILP32-ILP32F-WITHFP-NEXT: addi a1, a1, -1728 ; ILP32-ILP32F-WITHFP-NEXT: add sp, sp, a1 -; ILP32-ILP32F-WITHFP-NEXT: .cfi_def_cfa_offset 2032 +; ILP32-ILP32F-WITHFP-NEXT: .cfi_def_cfa sp, 2032 ; ILP32-ILP32F-WITHFP-NEXT: lw ra, 1996(sp) # 4-byte Folded Reload ; ILP32-ILP32F-WITHFP-NEXT: lw s0, 1992(sp) # 4-byte Folded Reload ; ILP32-ILP32F-WITHFP-NEXT: .cfi_restore ra @@ -2973,7 +2977,7 @@ define i32 @va_large_stack(ptr %fmt, ...) { ; ILP32E-WITHFP-NEXT: lui a1, 24414 ; ILP32E-WITHFP-NEXT: addi a1, a1, -1748 ; ILP32E-WITHFP-NEXT: add sp, sp, a1 -; ILP32E-WITHFP-NEXT: .cfi_def_cfa_offset 2044 +; ILP32E-WITHFP-NEXT: .cfi_def_cfa sp, 2044 ; ILP32E-WITHFP-NEXT: lw ra, 2016(sp) # 4-byte Folded Reload ; ILP32E-WITHFP-NEXT: lw s0, 2012(sp) # 4-byte Folded Reload ; ILP32E-WITHFP-NEXT: .cfi_restore ra @@ -3050,7 +3054,7 @@ define i32 @va_large_stack(ptr %fmt, ...) { ; LP64-LP64F-LP64D-WITHFP-NEXT: lui a1, 24414 ; LP64-LP64F-LP64D-WITHFP-NEXT: addiw a1, a1, -1680 ; LP64-LP64F-LP64D-WITHFP-NEXT: add sp, sp, a1 -; LP64-LP64F-LP64D-WITHFP-NEXT: .cfi_def_cfa_offset 2032 +; LP64-LP64F-LP64D-WITHFP-NEXT: .cfi_def_cfa sp, 2032 ; LP64-LP64F-LP64D-WITHFP-NEXT: ld ra, 1960(sp) # 8-byte Folded Reload ; LP64-LP64F-LP64D-WITHFP-NEXT: ld s0, 1952(sp) # 8-byte Folded Reload ; LP64-LP64F-LP64D-WITHFP-NEXT: .cfi_restore ra @@ -3119,7 +3123,7 @@ define i32 @va_large_stack(ptr %fmt, ...) { ; LP64E-WITHFP-NEXT: lui a1, 24414 ; LP64E-WITHFP-NEXT: addiw a1, a1, -1704 ; LP64E-WITHFP-NEXT: add sp, sp, a1 -; LP64E-WITHFP-NEXT: .cfi_def_cfa_offset 2040 +; LP64E-WITHFP-NEXT: .cfi_def_cfa sp, 2040 ; LP64E-WITHFP-NEXT: ld ra, 1984(sp) # 8-byte Folded Reload ; LP64E-WITHFP-NEXT: ld s0, 1976(sp) # 8-byte Folded Reload ; LP64E-WITHFP-NEXT: .cfi_restore ra