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

Eli Friedman via llvm-commits llvm-commits at lists.llvm.org
Mon May 19 14:03:15 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;
----------------
efriedma-quic wrote:

Pushed a fix.

The frame index in question is not actually a CSR, but there's open space in the CSR range due to alignment, so it gets allocated as part of the "CSR" area.  And the calculation was in fact broken in this case.

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


More information about the llvm-commits mailing list