Skip to content

Commit 7dbf92f

Browse files
committed
[AArch64][SME] Fix frame lowering not using a base pointer for SME functions.
The existing code is checking for the presence of the +sve subtarget feature when deciding to use a base pointer for the function, but this check doesn't work when only +sme is used. rdar://126878490
1 parent 5ad418b commit 7dbf92f

File tree

3 files changed

+1053
-1
lines changed

3 files changed

+1053
-1
lines changed

llvm/lib/Target/AArch64/AArch64RegisterInfo.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,9 @@ bool AArch64RegisterInfo::hasBasePointer(const MachineFunction &MF) const {
552552
if (hasStackRealignment(MF))
553553
return true;
554554

555-
if (MF.getSubtarget<AArch64Subtarget>().hasSVE()) {
555+
auto &ST = MF.getSubtarget<AArch64Subtarget>();
556+
if (ST.hasSVE() ||
557+
(ST.hasSME() && ST.hasStreamingInterfaceOrBody(MF.getFunction()))) {
556558
const AArch64FunctionInfo *AFI = MF.getInfo<AArch64FunctionInfo>();
557559
// Frames that have variable sized objects and scalable SVE objects,
558560
// should always use a basepointer.

llvm/lib/Target/AArch64/AArch64Subtarget.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,10 @@ class AArch64Subtarget final : public AArch64GenSubtargetInfo {
353353
bool hasSVEorSME() const { return hasSVE() || hasSME(); }
354354
bool hasSVE2orSME() const { return hasSVE2() || hasSME(); }
355355

356+
bool hasStreamingInterfaceOrBody(const Function &F) const {
357+
return SMEAttrs(F).hasStreamingInterfaceOrBody();
358+
}
359+
356360
// Return the known range for the bit length of SVE data registers. A value
357361
// of 0 means nothing is known about that particular limit beyong what's
358362
// implied by the architecture.

0 commit comments

Comments
 (0)