Skip to content

Commit 39026ce

Browse files
committed
[SOL] Create add64 r10, 0 for functions that do not need stack space (#158)
1 parent b1ab14b commit 39026ce

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

llvm/lib/Target/SBF/SBFFrameLowering.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ void SBFFrameLowering::emitPrologue(MachineFunction &MF,
2929
MachineBasicBlock::iterator MBBI = MBB.begin();
3030
MachineFrameInfo &MFI = MF.getFrameInfo();
3131
int NumBytes = (int)MFI.getStackSize();
32-
if (NumBytes) {
32+
if (NumBytes || MF.getSubtarget<SBFSubtarget>().getHasStaticSyscalls()) {
3333
DebugLoc Dl = MBBI->getDebugLoc();
3434
const SBFInstrInfo &TII =
3535
*static_cast<const SBFInstrInfo *>(MF.getSubtarget().getInstrInfo());

llvm/test/CodeGen/SBF/many_args_new_conv.ll

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
; RUN: llc -O2 -march=sbf -mcpu=v1 < %s | FileCheck %s
22
; RUN: llc -O2 -mtriple=sbpfv1-solana-solana < %s | FileCheck %s
33
; RUN: llc -O2 -march=sbf -mcpu=v1 -mattr=+mem-encoding < %s | FileCheck %s
4+
; RUN: llc -O3 -march=sbf -mcpu=v3 < %s | FileCheck --check-prefix=CHECK-V3 %s
45

56
; Function Attrs: nounwind uwtable
67
define i32 @caller_no_alloca(i32 %a, i32 %b, i32 %c) #0 {
@@ -9,6 +10,8 @@ entry:
910

1011
; No changes to the stack pointer
1112
; CHECK-NOT: add64 r10
13+
; Add zero to stack pointer from V3 onwards
14+
; CHECK-V3: add64 r10, 0
1215

1316
; Saving arguments on the stack
1417
; CHECK: stdw [r10 - 40], 60

0 commit comments

Comments
 (0)