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

via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 2 02:07:27 PDT 2026


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-backend-aarch64

Author: Cullen Rhodes (c-rhodes)

<details>
<summary>Changes</summary>

`fallBackToDAGISel` was constructing `SMECallAttrs` for every call even when the subtarget had no SME/SME2 support. This shows up in compile-time profiles without ever triggering a fallback.

https://llvm-compile-time-tracker.com/compare.php?from=ed44820f722aae43f1f00bb3e201300966716973&to=ba75f8fe1f0e44f7456dd282e066b6d6e781ada3&stat=instructions%3Au

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


1 Files Affected:

- (modified) llvm/lib/Target/AArch64/AArch64ISelLowering.cpp (+9-6) 


``````````diff
diff --git a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
index 38db1ac4a2fb9..3089220b13719 100644
--- a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
+++ b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
@@ -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()) {
+    if (auto *Base = dyn_cast<CallBase>(&Inst)) {
+      auto CallAttrs = SMECallAttrs(*Base, &getRuntimeLibcallsInfo());
+      if (CallAttrs.requiresSMChange() || CallAttrs.requiresLazySave() ||
+          CallAttrs.requiresPreservingZT0() ||
+          CallAttrs.requiresPreservingAllZAState())
+        return true;
+    }
   }
   return false;
 }

``````````

</details>


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


More information about the llvm-commits mailing list