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

Cullen Rhodes via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 2 06:19:34 PDT 2026


================
@@ -31418,11 +31418,16 @@ 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;
+    const Function *Caller = Base->getCaller();
+    if (Subtarget->hasSME() ||
+        Caller->hasFnAttribute("aarch64_pstate_sm_compatible") ||
+        Caller->hasFnAttribute("aarch64_za_state_agnostic")) {
----------------
c-rhodes wrote:

sure will do. For a bit more context, here's a flame graph from compiling sqlite: ![perf gisel O0](https://github.com/user-attachments/assets/2c33b0e2-ae8e-43be-a516-fd1f1f746dab)

the relevant bit is:
<img width="1203" height="803" alt="Screenshot 2026-04-02 at 10 47 16" src="https://github.com/user-attachments/assets/5f905af0-735b-4a8c-a7f0-9a6d9280885a" />

which shows the culprit is: https://github.com/llvm/llvm-project/blob/d0bf354828717ee7228527237e61e0fcccfe0f15/llvm/include/llvm/IR/RuntimeLibcalls.h#L140-L144

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


More information about the llvm-commits mailing list