[llvm] [AArch64][SME] Remove unused ZA lazy-save (PR #81648)

Sander de Smalen via llvm-commits llvm-commits at lists.llvm.org
Thu May 9 05:41:05 PDT 2024


================
@@ -2929,6 +2930,69 @@ AArch64TargetLowering::EmitZero(MachineInstr &MI, MachineBasicBlock *BB) const {
   return BB;
 }
 
+MachineBasicBlock *
+AArch64TargetLowering::EmitExpandZABuffer(MachineInstr &MI,
+                                          MachineBasicBlock *BB) const {
+  MachineFunction *MF = BB->getParent();
+  MachineFrameInfo &MFI = MF->getFrameInfo();
+  AArch64FunctionInfo *FuncInfo = MF->getInfo<AArch64FunctionInfo>();
+  // 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
+  assert(!MF->getSubtarget<AArch64Subtarget>().isTargetWindows() &&
----------------
sdesmalen-arm wrote:

I'm going to have to renege on my previous comment where I suggested to go back to a single pseudo.

If the target is windows or if the function has stack probing enabled, we'd probably just want to use `DYNAMIC_STACKALLOC` for the allocation and live with the fact that we don't remove the (unnecessary) instructions. At least that way, the implementation is correct, albeit less efficient.

So if we have a separate pseudo for simply allocating the stack space, we can choose whether to use the custom pseudo (that we expand after isel) or to use the regular DYNAMIC_STACKALLOC which gets normally lowered (in LowerDYNAMIC_STACKALLOC).

It would be good if the ExpandZABuffer pseudo would return a pointer to the new buffer, and for the other pseudo (that initialises the TPIDR2 object) to take that buffer pointer, so it can store that to the struct.

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


More information about the llvm-commits mailing list