From d7da2921b15270d87a3993313483e27bc8af297a Mon Sep 17 00:00:00 2001 From: Stefan Stipanovic Date: Thu, 18 Apr 2024 10:44:37 +0200 Subject: [PATCH] [Xtensa] Fix issue with adding scavenging frame index --- llvm/lib/Target/Xtensa/XtensaFrameLowering.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/llvm/lib/Target/Xtensa/XtensaFrameLowering.cpp b/llvm/lib/Target/Xtensa/XtensaFrameLowering.cpp index f1db383620b376..6c191e2cf2f135 100644 --- a/llvm/lib/Target/Xtensa/XtensaFrameLowering.cpp +++ b/llvm/lib/Target/Xtensa/XtensaFrameLowering.cpp @@ -399,7 +399,8 @@ void XtensaFrameLowering::processFunctionBeforeFrameFinalized( const TargetRegisterInfo &TRI = *MF.getSubtarget().getRegisterInfo(); unsigned Size = TRI.getSpillSize(RC); Align Alignment = TRI.getSpillAlign(RC); - for (int i = 0; i < NeedRegs; i++) + // If NeedsRegs == 0, we still need a spill slot + for (int i = 0; i <= NeedRegs; i++) RS->addScavengingFrameIndex( MFI.CreateStackObject(Size, Alignment, false)); }