[clang] [llvm] [AArch64][SME] Allow more inlining when SME attributes are incompatible. (PR #223393)

Benjamin Maxwell via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 17 08:55:09 PDT 2026


================
@@ -233,23 +233,99 @@ static bool isSMEABIRoutineCall(const CallInst &CI,
          SMEAttrs(F->getName(), TLI.getRuntimeLibcallsInfo()).isSMEABIRoutine();
 }
 
+/// Returns true if \p I is an intrinsic that may not be compatible with a
+/// different streaming mode (because it depends on vscale).
+static bool isPossiblyIncompatibleIntrinsic(const Instruction *I) {
+  if (I->isDebugOrPseudoInst())
+    return false;
+
+  if (auto *II = dyn_cast<IntrinsicInst>(I)) {
+    switch (II->getIntrinsicID()) {
+    default:
+      break;
+    case Intrinsic::vscale:
+    case Intrinsic::masked_gather:
+    case Intrinsic::masked_scatter:
+      return true;
+    }
+
+    StringRef Name = II->getCalledFunction()->getName();
+    if (Name.starts_with("llvm.aarch64.neon") ||
+        Name.starts_with("llvm.aarch64.sve") ||
+        Name.starts_with("llvm.aarch64.sme"))
+      return true;
----------------
MacDue wrote:

Is there a reason not to just do?

```suggestion
    return Intrinsic::isTargetIntrinsic(IID);
```

I suggested this as I thought we should have an explicit list of intrinsics we can inline, rather than implicitly saying any prefix not covered is legal. Right now, no tests fail with this change.   

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


More information about the cfe-commits mailing list