[llvm] [AArch64][SME] Support `aarch64-split-sve-objects` with VLAs/realignment (PR #163816)
Sander de Smalen via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 29 08:31:43 PDT 2025
================
@@ -1501,28 +1519,26 @@ void AArch64EpilogueEmitter::emitEpilogue() {
(AFI->isStackRealigned() || MFI.hasVarSizedObjects()) ? AArch64::FP
: AArch64::SP;
if (SVECalleeSavesSize && BaseForSVEDealloc == AArch64::FP) {
- // TODO: Support stack realigment and variable-sized objects.
- assert(
- SVELayout != SVEStackLayout::Split &&
- "unexpected stack realignment or variable sized objects with split "
- "SVE stack objects");
-
- Register CalleeSaveBase = AArch64::FP;
- if (int64_t CalleeSaveBaseOffset =
- AFI->getCalleeSaveBaseToFrameRecordOffset()) {
- // If we have have an non-zero offset to the non-SVE CS base we need to
- // compute the base address by subtracting the offest in a temporary
- // register first (to avoid briefly deallocating the SVE CS).
- CalleeSaveBase = MBB.getParent()->getRegInfo().createVirtualRegister(
- &AArch64::GPR64RegClass);
- emitFrameOffset(MBB, RestoreBegin, DL, CalleeSaveBase, AArch64::FP,
- StackOffset::getFixed(-CalleeSaveBaseOffset), TII,
+ // The offset from the frame-pointer to the start of the ZPR saves.
+ StackOffset FPOffsetZPR =
+ -SVECalleeSavesSize -
+ StackOffset::getFixed(AFI->getCalleeSaveBaseToFrameRecordOffset());
+
+ // With split SVE, the PPR locals are above the ZPR callee-saves.
+ if (ZPR.CalleeSavesSize && SVELayout == SVEStackLayout::Split)
+ FPOffsetZPR -= PPR.LocalsSize;
+
+ // Deallocate the stack space space by moving the SP to the start of the
+ // ZPR/PPR callee-save area.
+ moveSPBelowFP(ZPRRange.Begin, FPOffsetZPR);
----------------
sdesmalen-arm wrote:
If the code below uses FP as the base register, then this can be predicated under `if (ZPR.CalleeSavesSize) `.
https://github.com/llvm/llvm-project/pull/163816
More information about the llvm-commits
mailing list