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

Benjamin Maxwell via llvm-commits llvm-commits at lists.llvm.org
Mon May 19 05:31:16 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;
----------------
MacDue wrote:

I added the assert ` assert(!(AFI->getSVECalleeSavedStackSize() && isCSR));` and it seems this can get hit by `AArch64RegisterInfo::eliminateFrameIndex`, which seems to need the correct offset. It only fails for one test though (`llvm/test/CodeGen/AArch64/stack-hazard.ll`, `@svecc_csr_d8_allocd`).

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


More information about the llvm-commits mailing list