[llvm] [AArch64] Restore Z-registers before P-registers (PR #79623)

Visoiu Mistrih Francis via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 12 10:36:46 PST 2024


================
@@ -3201,11 +3196,27 @@ bool AArch64FrameLowering::restoreCalleeSavedRegisters(
     return true;
   }
 
+  // For performance reasons restore SVE register in increasing order
+  auto PPRBegin =
+      std::find_if(RegPairs.begin(), RegPairs.end(), [](const RegPairInfo &c) {
+        return c.Type == RegPairInfo::PPR;
+      });
+  auto PPREnd = std::find_if(
+      RegPairs.rbegin(), RegPairs.rend(),
+      [](const RegPairInfo &c) { return c.Type == RegPairInfo::PPR; });
+  std::reverse(PPRBegin, PPREnd.base());
+  auto ZPRBegin =
+      std::find_if(RegPairs.begin(), RegPairs.end(), [](const RegPairInfo &c) {
+        return c.Type == RegPairInfo::ZPR;
+      });
+  auto ZPREnd = std::find_if(
+      RegPairs.rbegin(), RegPairs.rend(),
+      [](const RegPairInfo &c) { return c.Type == RegPairInfo::ZPR; });
+  std::reverse(ZPRBegin, ZPREnd.base());
+
   if (ReverseCSRRestoreSeq) {
----------------
francisvm wrote:

We can remove it! I added it for experiments at first and it didn't turn out useful in the end.

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


More information about the llvm-commits mailing list