[llvm] [AArch64][GISel] Skip SME call-attr checks on non-SME targets (PR #190135)

Sander de Smalen via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 2 02:50:18 PDT 2026


================
@@ -31417,12 +31417,15 @@ bool AArch64TargetLowering::fallBackToDAGISel(const Instruction &Inst) const {
   }
 
   // Checks to allow the use of SME instructions
-  if (auto *Base = dyn_cast<CallBase>(&Inst)) {
-    auto CallAttrs = SMECallAttrs(*Base, &getRuntimeLibcallsInfo());
-    if (CallAttrs.requiresSMChange() || CallAttrs.requiresLazySave() ||
-        CallAttrs.requiresPreservingZT0() ||
-        CallAttrs.requiresPreservingAllZAState())
-      return true;
+  // If the subtarget lacks SME/SME2 we can skip per-call SME attribute checks.
+  if (Subtarget->hasSME() || Subtarget->hasSME2()) {
----------------
sdesmalen-arm wrote:

You can wrap this in something like:
```
if (auto *Base = dyn_cast<CallBase>(&Inst)) {
  const Function *Caller = Base->getCaller();
  if (Subtarget->hasSME() ||
      Caller->hasFnAttribute("aarch64_pstate_sm_compatible") ||
      Caller->hasFnAttribute("aarch64_za_state_agnostic") {
    auto CallAttrs = SMECallAttrs(*Base, &getRuntimeLibcallsInfo());
    ...
  }
}
```
?

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


More information about the llvm-commits mailing list