[llvm] [AArch64] Restore always-inline behaviour for incompatible SME attributes. (PR #218727)

Sander de Smalen via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 8 03:52:50 PDT 2026


================
@@ -301,7 +301,17 @@ bool AArch64TTIImpl::areInlineCompatible(const Function *Caller,
   if (CallAttrs.requiresLazySave() || CallAttrs.requiresSMChange() ||
       CallAttrs.requiresPreservingZT0() ||
       CallAttrs.requiresPreservingAllZAState()) {
-    if (hasPossibleIncompatibleOps(Callee, *getTLI()))
+    // For always-inline functions we don't check the SME attributes as
+    // otherwise it would block simple 'alwaysinline' utility functions in
+    // existing libraries from being inlined in streaming functions (e.g.
+    // std::max). Clang issues a warning diagnostic for this case to warn the
+    // user that always-inlining the function may not be safe. Unfortunately, it
+    // is difficult to comprehensively guard against this in Clang, as it would
+    // require analyzing the function bodies for all always-inline functions
+    // for each of their call-sites. The approach taken here is therefore a
----------------
sdesmalen-arm wrote:

I've added a FIXME 👍 

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


More information about the llvm-commits mailing list