Skip to content

Commit d57e83d

Browse files
committed
Fixups
1 parent c2a047c commit d57e83d

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

llvm/lib/Target/AArch64/AArch64MachineFunctionInfo.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,8 @@ class AArch64FunctionInfo final : public MachineFunctionInfo {
315315
}
316316

317317
void setStackSizeSVE(uint64_t ZPR, uint64_t PPR) {
318+
assert(isAligned(Align(16), ZPR) && isAligned(Align(16), PPR) &&
319+
"expected SVE stack sizes to be aligned to 16-bytes");
318320
StackSizeZPR = ZPR;
319321
StackSizePPR = PPR;
320322
HasCalculatedStackSizeSVE = true;
@@ -425,6 +427,8 @@ class AArch64FunctionInfo final : public MachineFunctionInfo {
425427

426428
// Saves the CalleeSavedStackSize for SVE vectors in 'scalable bytes'
427429
void setSVECalleeSavedStackSize(unsigned ZPR, unsigned PPR) {
430+
assert(isAligned(Align(16), ZPR) && isAligned(Align(16), PPR) &&
431+
"expected SVE callee-save sizes to be aligned to 16-bytes");
428432
ZPRCalleeSavedStackSize = ZPR;
429433
PPRCalleeSavedStackSize = PPR;
430434
HasSVECalleeSavedStackSize = true;

llvm/lib/Target/AArch64/AArch64PrologueEpilogue.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -799,8 +799,10 @@ void AArch64PrologueEmitter::emitPrologue() {
799799
NonSVELocalsSize);
800800
CFAOffset += AllocateAfterPPRs;
801801
} else {
802-
// Note: With CalleeSavesAboveFrameRecord the SVE CS have already been
803-
// allocated (and separate PPRLocals are not supported).
802+
assert(SVELayout == SVEStackLayout::CalleeSavesAboveFrameRecord);
803+
// Note: With CalleeSavesAboveFrameRecord, the SVE CS have already been
804+
// allocated (and separate PPR locals are not supported, all SVE locals,
805+
// both PPR and ZPR, are within the ZPR locals area).
804806
assert(!PPR.LocalsSize && "Unexpected PPR locals!");
805807
CFAOffset += SVECalleeSavesSize;
806808
}
@@ -1276,6 +1278,8 @@ void AArch64PrologueEmitter::emitCalleeSavedSVELocations(
12761278
StackOffset::getScalable(MFI.getObjectOffset(FI)) -
12771279
StackOffset::getFixed(AFI->getCalleeSavedStackSize(MFI));
12781280

1281+
// The scalable vectors are below (lower address) the scalable predicates
1282+
// with split SVE objects, so we must subtract the size of the predicates.
12791283
if (SVELayout == SVEStackLayout::Split &&
12801284
MFI.getStackID(FI) == TargetStackID::ScalableVector)
12811285
Offset -= PPRStackSize;

0 commit comments

Comments
 (0)