[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
Thu Feb 29 06:36:16 PST 2024
================
@@ -7513,6 +7516,36 @@ void Sema::checkCall(NamedDecl *FDecl, const FunctionProtoType *Proto,
}
}
+ auto *CallerFD = dyn_cast<FunctionDecl>(CurContext);
+ bool IsCalleeStreaming =
+ (ExtInfo.AArch64SMEAttributes & FunctionType::SME_PStateSMEnabledMask);
+ bool IsCalleeStreamingCompatible =
+ (ExtInfo.AArch64SMEAttributes &
+ FunctionType::SME_PStateSMCompatibleMask);
+ bool IsBuiltin = (FD && FD->getBuiltinID());
+ AnyScalableArgsOrRet |= Proto->getReturnType()->isSizelessVectorType();
+
+ // If the caller is a function and the callee has a different
+ // non-compitable streaming attribute. If it passed any VL-based arguments
+ // or return VL-based value, then warn that the streaming and non-streaming
+ // vector lengths may be different.
+ if (CallerFD && Context.getTargetInfo().hasFeature("sme") && !IsBuiltin) {
----------------
sdesmalen-arm wrote:
```suggestion
if (CallerFD && !IsBuiltin) {
```
It is valid to compile the following function without `+sme`:
```
void streaming_compatible_fn(svint32_t v, void (*foo)(svint32_t)) __arm_streaming_compatible {
foo(v);
}
```
https://github.com/llvm/llvm-project/pull/79842
More information about the cfe-commits
mailing list