[llvm] [AArch64][SME] Support Windows/stack probes in MachineSMEABIPass (PR #149063)

Sander de Smalen via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 5 05:26:07 PDT 2025


================
@@ -8291,7 +8291,30 @@ SDValue AArch64TargetLowering::LowerFormalArguments(
   if (Subtarget->hasCustomCallingConv())
     Subtarget->getRegisterInfo()->UpdateCustomCalleeSavedRegs(MF);
 
-  if (!getTM().useNewSMEABILowering() || Attrs.hasAgnosticZAInterface()) {
+  if (getTM().useNewSMEABILowering() && !Attrs.hasAgnosticZAInterface()) {
+    if (Subtarget->isTargetWindows() || hasInlineStackProbe(MF)) {
+      SDValue Size;
+      if (Attrs.hasZAState()) {
----------------
sdesmalen-arm wrote:

Can these conditions be merged, so that we can avoid the extra `if (Size) { .. }` condition below.
Also, if `Attrs.hasZAState() == true`, then the function cannot have an agnostic ZA interface so the `!Attrs.hasAgnosticZAInterface()` clause can be removed, e.g.

```
if (getTM().useNewSMEABILowering() && Attrs.hasZAState() && 
    (Subtarget->isTargetWindows() || hasInlineStackProbe(MF))) {
  SDValue Size = ...
  ...
}
```

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


More information about the llvm-commits mailing list