[llvm] [AArch64][SVE] Coalesce SVE prologue/epilogue stack adjustments (PR #163956)

Sam Tebbs via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 21 02:15:09 PDT 2025


================
@@ -370,6 +370,21 @@ SVEFrameSizes AArch64PrologueEpilogueCommon::getSVEStackFrameSizes() const {
           {ZPRCalleeSavesSize, PPRLocalsSize + ZPRLocalsSize}};
 }
 
+SVEStackAllocations AArch64PrologueEpilogueCommon::getSVEStackAllocations(
+    SVEFrameSizes const &SVE) {
+  StackOffset AfterZPRs = SVE.ZPR.LocalsSize;
+  StackOffset BeforePPRs = SVE.ZPR.CalleeSavesSize + SVE.PPR.CalleeSavesSize;
+  StackOffset AfterPPRs = {};
+  if (SVELayout == SVEStackLayout::Split) {
+    BeforePPRs = SVE.PPR.CalleeSavesSize;
+    if (SVE.ZPR.CalleeSavesSize)
+      AfterPPRs += SVE.PPR.LocalsSize + SVE.ZPR.CalleeSavesSize;
+    else
+      AfterZPRs += SVE.PPR.LocalsSize; // Group allocation of locals.
----------------
SamTebbs33 wrote:

Isn't this the same thing as `AfterZPRs += SVE.PPR.LocalsSize + SVE.ZPR.CalleeSavesSize`? If `CalleeSavesSize` is zero (falsey) then adding it is fine.

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


More information about the llvm-commits mailing list