From 06f5102b8c5191566eac0eebd18ba48607d797a3 Mon Sep 17 00:00:00 2001 From: Yusra Syeda Date: Wed, 4 Oct 2023 16:55:45 -0400 Subject: [PATCH] update lowercall --- llvm/lib/Target/SystemZ/SystemZFrameLowering.cpp | 12 ++++++++++++ llvm/lib/Target/SystemZ/SystemZISelLowering.cpp | 7 ------- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/llvm/lib/Target/SystemZ/SystemZFrameLowering.cpp b/llvm/lib/Target/SystemZ/SystemZFrameLowering.cpp index 11a59df899a1a..75a37060a8d06 100644 --- a/llvm/lib/Target/SystemZ/SystemZFrameLowering.cpp +++ b/llvm/lib/Target/SystemZ/SystemZFrameLowering.cpp @@ -1423,6 +1423,18 @@ void SystemZXPLINKFrameLowering::processFunctionBeforeFrameFinalized( // Setup stack frame offset MFFrame.setOffsetAdjustment(Regs.getStackPointerBias()); + + // Nothing to do for leaf functions. + uint64_t StackSize = MFFrame.estimateStackSize(MF); + if (StackSize == 0 && MFFrame.getCalleeSavedInfo().empty()) + return; + + // Although the XPLINK specifications for AMODE64 state that minimum size + // of the param area is minimum 32 bytes and no rounding is otherwise + // specified, we round this area in 64 bytes increments to be compatible + // with existing compilers. + MFFrame.setMaxCallFrameSize( + std::max(64U, (unsigned)alignTo(MFFrame.getMaxCallFrameSize(), 64))); } // Determines the size of the frame, and creates the deferred spill objects. diff --git a/llvm/lib/Target/SystemZ/SystemZISelLowering.cpp b/llvm/lib/Target/SystemZ/SystemZISelLowering.cpp index da3129f08c288..5c5cb964bd28d 100644 --- a/llvm/lib/Target/SystemZ/SystemZISelLowering.cpp +++ b/llvm/lib/Target/SystemZ/SystemZISelLowering.cpp @@ -1816,13 +1816,6 @@ SystemZTargetLowering::LowerCall(CallLoweringInfo &CLI, // Get a count of how many bytes are to be pushed on the stack. unsigned NumBytes = ArgCCInfo.getStackSize(); - if (Subtarget.isTargetXPLINK64()) - // Although the XPLINK specifications for AMODE64 state that minimum size - // of the param area is minimum 32 bytes and no rounding is otherwise - // specified, we round this area in 64 bytes increments to be compatible - // with existing compilers. - NumBytes = std::max(64U, (unsigned)alignTo(NumBytes, 64)); - // Mark the start of the call. if (!IsTailCall) Chain = DAG.getCALLSEQ_START(Chain, NumBytes, 0, DL);