================
@@ -465,23 +473,25 @@ void MachineSMEABI::emitAllocateLazySaveBuffer(
   auto &Subtarget = MF.getSubtarget<AArch64Subtarget>();
   const TargetInstrInfo &TII = *Subtarget.getInstrInfo();
   MachineRegisterInfo &MRI = MF.getRegInfo();
+  auto *AFI = MF.getInfo<AArch64FunctionInfo>();
 
   DebugLoc DL = getDebugLoc(MBB, MBBI);
   Register SP = MRI.createVirtualRegister(&AArch64::GPR64RegClass);
   Register SVL = MRI.createVirtualRegister(&AArch64::GPR64RegClass);
-  Register Buffer = MRI.createVirtualRegister(&AArch64::GPR64RegClass);
+  Register Buffer = AFI->getEarlyAllocSMESaveBuffer();
 
   // Calculate SVL.
   BuildMI(MBB, MBBI, DL, TII.get(AArch64::RDSVLI_XI), SVL).addImm(1);
 
   // 1. Allocate the lazy save buffer.
-  {
+  if (Buffer == AArch64::NoRegister) {
     // TODO This function grows the stack with a subtraction, which doesn't 
work
     // on Windows. Some refactoring to share the functionality in
     // LowerWindowsDYNAMIC_STACKALLOC will be required once the Windows ABI
     // supports SME
----------------
MacDue wrote:

I've rewritten this comment :+1: I think there's still a TODO to improve how 
this is handled. 

https://github.com/llvm/llvm-project/pull/149063
_______________________________________________
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to