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

Eli Friedman via llvm-commits llvm-commits at lists.llvm.org
Fri May 16 11:17:32 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:

Can you think of any way to write a test involving callee-saves in resolveFrameOffsetReference?  I think maybe debug info calls into this code, but I don't think the result is relevant for the actual debug info.  And I don't think anything else refers to callee-saves like this: the prologue/epilogue code doesn't resolve offsets like this, and nothing else has any reason to refer to them.

I guess the fix is to change the `isFixed || isCSR` to just `isFixed`?

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


More information about the llvm-commits mailing list