[llvm] [AArch64] SME implementation for agnostic-ZA functions (PR #120150)

Eli Friedman via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 16 14:58:57 PST 2024


================
@@ -240,6 +240,17 @@ static bool hasPossibleIncompatibleOps(const Function *F) {
           (cast<CallInst>(I).isInlineAsm() || isa<IntrinsicInst>(I) ||
            isSMEABIRoutineCall(cast<CallInst>(I))))
         return true;
+
+      if (auto *CB = dyn_cast<CallBase>(&I)) {
+        SMEAttrs CallerAttrs(*CB->getCaller()),
+            CalleeAttrs(*CB->getCalledFunction());
+        // When trying to determine if we can inline callees, we must check
+        // that for agnostic-ZA functions, they don't call any functions
+        // that are not agnostic-ZA, as that would require inserting of
+        // save/restore code.
----------------
efriedma-quic wrote:

What problem is this solving?  If we inline calls that might clobber za in a context where za is not live, it doesn't matter.  If we inline calls that might clobber za into a context where za might be live, we'll insert save/restore calls.

If we care about reducing the number of save/restore calls, we can change code generation to remove redundant restore/save pairs.  (We can use a dataflow analysis after isel.)

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


More information about the llvm-commits mailing list