Skip to content

Commit b1ab14b

Browse files
committed
[SOL] Do not add stack pointer adjustment at end (#156)
1 parent 20ded7c commit b1ab14b

File tree

5 files changed

+15
-30
lines changed

5 files changed

+15
-30
lines changed

.github/workflows/llvm-project-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ on:
1414
required: false
1515
os_list:
1616
required: false
17-
default: '["ubuntu-22.04", "windows-2019", "macOS-13"]'
17+
default: '["ubuntu-22.04", "windows-2022", "macOS-13"]'
1818
python_version:
1919
required: false
2020
type: string

llvm/lib/Target/SBF/SBFFrameLowering.cpp

Lines changed: 10 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -19,43 +19,28 @@
1919

2020
using namespace llvm;
2121

22-
namespace {
22+
bool SBFFrameLowering::hasFP(const MachineFunction &MF) const { return true; }
2323

24-
void adjustStackPointer(MachineFunction &MF, MachineBasicBlock &MBB,
25-
MachineBasicBlock::iterator &MBBI, bool IsSubtract) {
24+
void SBFFrameLowering::emitPrologue(MachineFunction &MF,
25+
MachineBasicBlock &MBB) const {
26+
if (!MF.getSubtarget<SBFSubtarget>().getHasDynamicFrames()) {
27+
return;
28+
}
29+
MachineBasicBlock::iterator MBBI = MBB.begin();
2630
MachineFrameInfo &MFI = MF.getFrameInfo();
2731
int NumBytes = (int)MFI.getStackSize();
2832
if (NumBytes) {
29-
DebugLoc Dl;
33+
DebugLoc Dl = MBBI->getDebugLoc();
3034
const SBFInstrInfo &TII =
3135
*static_cast<const SBFInstrInfo *>(MF.getSubtarget().getInstrInfo());
3236
BuildMI(MBB, MBBI, Dl, TII.get(SBF::ADD_ri), SBF::R10)
3337
.addReg(SBF::R10)
34-
.addImm(IsSubtract ? -NumBytes : NumBytes);
38+
.addImm(-NumBytes);
3539
}
3640
}
3741

38-
} // namespace
39-
40-
bool SBFFrameLowering::hasFP(const MachineFunction &MF) const { return true; }
41-
42-
void SBFFrameLowering::emitPrologue(MachineFunction &MF,
43-
MachineBasicBlock &MBB) const {
44-
if (!MF.getSubtarget<SBFSubtarget>().getHasDynamicFrames()) {
45-
return;
46-
}
47-
MachineBasicBlock::iterator MBBI = MBB.begin();
48-
adjustStackPointer(MF, MBB, MBBI, true);
49-
}
50-
5142
void SBFFrameLowering::emitEpilogue(MachineFunction &MF,
52-
MachineBasicBlock &MBB) const {
53-
if (!MF.getSubtarget<SBFSubtarget>().getHasDynamicFrames()) {
54-
return;
55-
}
56-
MachineBasicBlock::iterator MBBI = MBB.getLastNonDebugInstr();
57-
adjustStackPointer(MF, MBB, MBBI, false);
58-
}
43+
MachineBasicBlock &MBB) const {}
5944

6045
void SBFFrameLowering::determineCalleeSaves(MachineFunction &MF,
6146
BitVector &SavedRegs,

llvm/test/CodeGen/SBF/dynamic_stack_frame_add_not_sub.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
define i32 @test_func(ptr noundef %vec, i32 noundef %idx) #0 {
1414
; CHECK-LABEL: test_func:
1515
; CHECK: add64 r10, -128
16-
; CHECK: add64 r10, 128
16+
; CHECK-NOT: add64 r10, 128
1717
entry:
1818
%vec.addr = alloca ptr, align 8
1919
%idx.addr = alloca i512, align 4

llvm/test/CodeGen/SBF/many_args_new_conv.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ define i32 @callee_alloca(i32 %a, i32 %b, i32 %c, i32 %d, i32 %e, i32 %f, i32 %p
6868
; CHECK: ldxdw r2, [r10 + 88]
6969
; Loading allocated i32
7070
; CHECK: ldxw r0, [r10 + 24]
71-
; CHECK: add64 r10, 128
71+
; CHECK-NOT: add64 r10, 128
7272

7373
entry:
7474
%o = alloca i512
@@ -97,7 +97,7 @@ define i32 @callee_no_alloca(i32 %a, i32 %b, i32 %c, i32 %d, i32 %e, i32 %f, i32
9797
; CHECK: ldxdw r1, [r10 + 32]
9898
; CHECK: ldxdw r1, [r10 + 24]
9999

100-
; CHECK: add64 r10, 64
100+
; CHECK-NOT: add64 r10, 64
101101
entry:
102102
%g = add i32 %a, %b
103103
%h = sub i32 %g, %c

llvm/test/CodeGen/SBF/stack_args_v2.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ define i32 @bar(i32 %a, i32 %b, i32 %c, i32 %d, i32 %e, i32 %f) #1 {
2424
; CHECK: sub64 r0, r5
2525
; CHECK: ldxdw r1, [r10 + 56]
2626
; CHECK: add64 r0, r1
27-
; CHECK: add64 r10, 64
27+
; CHECK-NOT: add64 r10, 64
2828
entry:
2929
%g = add i32 %a, %b
3030
%h = sub i32 %g, %c

0 commit comments

Comments
 (0)