[clang] [AArch64] Add option -msve-streaming-vector-bits= . (PR #144611)

Sander de Smalen via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 3 09:20:29 PDT 2025


================
@@ -2261,6 +2261,21 @@ void Sema::checkTypeSupport(QualType Ty, SourceLocation Loc, ValueDecl *D) {
         }
       }
     }
+
+    if (auto *VT = Ty->getAs<VectorType>();
+        VT && FD &&
+        (VT->getVectorKind() == VectorKind::SveFixedLengthData ||
+         VT->getVectorKind() == VectorKind::SveFixedLengthPredicate)) {
+      if (IsArmStreamingFunction(FD, /*IncludeLocallyStreaming=*/true)) {
+        Diag(Loc, diag::err_sve_fixed_vector_in_streaming_function) << Ty << 0;
+      } else if (const auto *FTy = FD->getType()->getAs<FunctionProtoType>()) {
+        if (FTy->getAArch64SMEAttributes() &
+            FunctionType::SME_PStateSMCompatibleMask) {
+          Diag(Loc, diag::err_sve_fixed_vector_in_streaming_function)
----------------
sdesmalen-arm wrote:

> Your last two testcases are the same: the conversion happens in the caller, so the first case reduces to the second.

Yes, I agree. I just wasn't sure if it would somehow take a slightly different path in clang somehow.

> Which is an issue, I guess, but not directly related to this patch

This patch adds extra information that proves this conversion is not valid, whereas before the compiler could not prove it and assumed the user knew what they were doing. I'm happy for it to be done as a follow-up though.

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


More information about the cfe-commits mailing list