[llvm] [AArch64] Reorder callee-saved spills to maximise load/store register groupings (PR #229349)

Jonathan Thackray via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 7 03:25:36 PDT 2026


================
@@ -2836,12 +2836,13 @@ void AArch64FrameLowering::determineCalleeSaves(MachineFunction &MF,
   AFI->setSVECalleeSavedStackSize(ZPRCSStackSize, alignTo(PPRCSStackSize, 16));
 }
 
-static void orderZPRCalleeSavesForPairs(MachineFunction &MF,
-                                        const TargetRegisterInfo *RegInfo,
-                                        std::vector<CalleeSavedInfo> &CSI) {
-  // Reorder callee-saved ZPRs to maximize pairing which requires
-  // consecutive even/odd registers at even scaled stack offsets.
-  // Additional requirements are checked when the register pairs are formed.
+static void orderZPRCalleeSavesForGroups(MachineFunction &MF,
+                                         const TargetRegisterInfo *RegInfo,
+                                         std::vector<CalleeSavedInfo> &CSI) {
+  // Reorder ZPRs to maximize grouping, quads and pairs.
+  // The main condition we try to satisfy is the offset.
+  // Quads require a scaled offset % 4
+  // Pairs require a scaled offset % 2
----------------
jthackray wrote:

Perhaps make this `offset % 2 == 0` for clarity?

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


More information about the llvm-commits mailing list