[clang] [llvm] [AArch64] Stack probing for function prologues (PR #66524)
Momchil Velikov via cfe-commits
cfe-commits at lists.llvm.org
Tue Nov 21 16:41:14 PST 2023
================
@@ -1827,12 +1908,36 @@ void AArch64FrameLowering::emitPrologue(MachineFunction &MF,
// FIXME: in the case of dynamic re-alignment, NumBytes doesn't have
// the correct value here, as NumBytes also includes padding bytes,
// which shouldn't be counted here.
- emitFrameOffset(
- MBB, MBBI, DL, scratchSPReg, AArch64::SP,
- StackOffset::getFixed(-NumBytes), TII, MachineInstr::FrameSetup,
- false, NeedsWinCFI, &HasWinCFI, EmitAsyncCFI && !HasFP,
+ StackOffset CFAOffset =
SVEStackSize +
- StackOffset::getFixed((int64_t)MFI.getStackSize() - NumBytes));
+ StackOffset::getFixed((int64_t)MFI.getStackSize() - NumBytes);
+ if (NeedsStackProbe && !NeedsRealignment) {
+ // If we don't need to re-align the stack, we can use a more efficient
+ // sequence for stack probing.
+ Register ScratchReg = findScratchNonCalleeSaveRegister(&MBB);
----------------
momchil-velikov wrote:
Because we may issue a loop when replacing `PROBED_STACKALLOC` and that loop uses a scratch register (containing the new `SP` value) in the loop exit condition.
https://github.com/llvm/llvm-project/pull/66524
More information about the cfe-commits
mailing list