[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:26:34 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:

Even if the target only has SVE, streaming-mode changes might still be required, e.g. https://godbolt.org/z/n53zsffsh 

This allows writing streaming-compatible functions that work with both SVE and SME, without requiring SME to be available. I think a similar thing also holds for `__arm_agnostic("sme_za_state")`.

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


More information about the llvm-commits mailing list