[llvm] [AArch64] Initial compiler support for SVE unwind on Windows. (PR #138609)

Benjamin Maxwell via llvm-commits llvm-commits at lists.llvm.org
Fri May 16 05:52:51 PDT 2025


================
@@ -2757,10 +2871,25 @@ StackOffset AArch64FrameLowering::resolveFrameOffsetReference(
   }
 
   StackOffset ScalableOffset = {};
-  if (UseFP && !(isFixed || isCSR))
-    ScalableOffset = -SVEStackSize;
-  if (!UseFP && (isFixed || isCSR))
-    ScalableOffset = SVEStackSize;
+  if (FPAfterSVECalleeSaves) {
+    // In this stack layout, the FP is in between the callee saves and other
+    // SVE allocations.
+    StackOffset SVECalleeSavedStack =
+        StackOffset::getScalable(AFI->getSVECalleeSavedStackSize());
+    if (UseFP) {
+      if (!(isFixed || isCSR))
+        ScalableOffset = SVECalleeSavedStack - SVEStackSize;
+      else
+        ScalableOffset = SVECalleeSavedStack;
+    } else if (!UseFP && (isFixed || isCSR)) {
+      ScalableOffset = SVEStackSize;
----------------
MacDue wrote:

Again, this looks like it could be incorrect for fixed CSRs, which are `SVEStackSize - SVECalleeSavedStack` above the SP.

https://github.com/llvm/llvm-project/pull/138609


More information about the llvm-commits mailing list