[clang] [Clang][AArch64] Warn when calling streaming/non-streaming about vect… (PR #79842)

Sander de Smalen via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 2 05:50:27 PST 2024


================
@@ -7513,6 +7516,44 @@ void Sema::checkCall(NamedDecl *FDecl, const FunctionProtoType *Proto,
       }
     }
 
+    auto *CallerFD = dyn_cast<FunctionDecl>(CurContext);
+    if (FD && CallerFD && Context.getTargetInfo().hasFeature("sme") &&
+        !FD->getBuiltinID()) {
+      // If the callee has an AArch64 SME __arm_locally_streaming attribute
+      // warn if this function returns VL-based value or pass any such argument,
+      // the streaming and non-streaming vector lengths may be different.
+      ArmStreamingType CalleeFnType = getArmStreamingFnType(FD);
+      ArmStreamingType CallerFnType = getArmStreamingFnType(CallerFD);
+      if (FD->hasAttr<ArmLocallyStreamingAttr>()) {
+        if (AnyScalableArgs)
+          Diag(Loc, diag::warn_sme_locally_streaming_has_vl_args);
+        if (FD->getReturnType()->isSizelessVectorType())
+          Diag(Loc, diag::warn_sme_locally_streaming_returns_vl);
+      }
----------------
sdesmalen-arm wrote:

`__arm_locally_streaming` is not a property of a function interface and therefore unrelated to a function _call_. That's why this code should live somewhere else.

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


More information about the cfe-commits mailing list