Skip to content

Commit 1ce497f

Browse files
committed
[RISCV] fix SP recovery in varargs functions
1 parent a508888 commit 1ce497f

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

llvm/lib/Target/RISCV/RISCVFrameLowering.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -809,9 +809,7 @@ void RISCVFrameLowering::emitEpilogue(MachineFunction &MF,
809809
uint64_t StackSize = FirstSPAdjustAmount ? FirstSPAdjustAmount
810810
: getStackSizeWithRVVPadding(MF) -
811811
RVFI->getReservedSpillsSize();
812-
uint64_t FPOffset = FirstSPAdjustAmount ? FirstSPAdjustAmount
813-
: getStackSizeWithRVVPadding(MF) -
814-
RVFI->getVarArgsSaveSize();
812+
uint64_t FPOffset = RealStackSize - RVFI->getVarArgsSaveSize();
815813
uint64_t RVVStackSize = RVFI->getRVVStackSize();
816814

817815
bool RestoreFP = RI->hasStackRealignment(MF) || MFI.hasVarSizedObjects() ||

0 commit comments

Comments
 (0)