[PATCH] D111133: [AARCH64] Teach AArch64FrameLowering::getFrameIndexReferencePreferSP really prefer SP.
Serguei Katkov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 18 20:15:34 PST 2021
This revision was automatically updated to reflect the committed changes.
Closed by commit rG3557f493534b: [AARCH64] Teach AArch64FrameLowering::getFrameIndexReferencePreferSP really… (authored by skatkov).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D111133/new/
https://reviews.llvm.org/D111133
Files:
llvm/lib/Target/AArch64/AArch64FrameLowering.cpp
llvm/test/CodeGen/AArch64/statepoint-call-lowering-sp.ll
Index: llvm/test/CodeGen/AArch64/statepoint-call-lowering-sp.ll
===================================================================
--- /dev/null
+++ llvm/test/CodeGen/AArch64/statepoint-call-lowering-sp.ll
@@ -0,0 +1,23 @@
+; RUN: llc -mtriple aarch64-none-linux-gnu -verify-machineinstrs -stop-after=prologepilog < %s | FileCheck %s
+
+; Check that STATEPOINT instruction prefer to use sp in presense of fp.
+target datalayout = "e-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "aarch64-unknown-linux-gnu"
+
+declare void @consume(i32 addrspace(1)* %obj)
+
+define i1 @test(i32 addrspace(1)* %a) "frame-pointer"="all" gc "statepoint-example" {
+entry:
+ %safepoint_token = tail call token (i64, i32, i1 ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_i1f(i64 0, i32 0, i1 ()* @return_i1, i32 0, i32 0, i32 0, i32 0) ["gc-live" (i32 addrspace(1)* %a)]
+; CHECK: STATEPOINT 0, 0, 0, @return_i1, 2, 0, 2, 0, 2, 0, 2, 1, 1, 8, $sp, 24, 2, 0, 2, 1, 0, 0
+ %call1 = call i32 addrspace(1)* @llvm.experimental.gc.relocate.p1i32(token %safepoint_token, i32 0, i32 0)
+ %call2 = call zeroext i1 @llvm.experimental.gc.result.i1(token %safepoint_token)
+ call void @consume(i32 addrspace(1)* %call1)
+ ret i1 %call2
+}
+
+
+declare i1 @return_i1()
+declare token @llvm.experimental.gc.statepoint.p0f_i1f(i64, i32, i1 ()*, i32, i32, ...)
+declare i32 addrspace(1)* @llvm.experimental.gc.relocate.p1i32(token, i32, i32)
+declare i1 @llvm.experimental.gc.result.i1(token)
Index: llvm/lib/Target/AArch64/AArch64FrameLowering.cpp
===================================================================
--- llvm/lib/Target/AArch64/AArch64FrameLowering.cpp
+++ llvm/lib/Target/AArch64/AArch64FrameLowering.cpp
@@ -3537,7 +3537,14 @@
return StackOffset::getFixed(MFI.getObjectOffset(FI));
}
- return getFrameIndexReference(MF, FI, FrameReg);
+ // Go to common code if we cannot provide sp + offset.
+ if (MFI.hasVarSizedObjects() ||
+ MF.getInfo<AArch64FunctionInfo>()->getStackSizeSVE() ||
+ MF.getSubtarget().getRegisterInfo()->hasStackRealignment(MF))
+ return getFrameIndexReference(MF, FI, FrameReg);
+
+ FrameReg = AArch64::SP;
+ return getStackOffset(MF, MFI.getObjectOffset(FI));
}
/// The parent frame offset (aka dispFrame) is only used on X86_64 to retrieve
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D111133.388369.patch
Type: text/x-patch
Size: 2298 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211119/6e051566/attachment.bin>
More information about the llvm-commits
mailing list