================ @@ -7513,6 +7516,38 @@ 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 the caller is a non-streaming function and the callee has a + // 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 (CallerFnType != ArmStreaming) { + if (CalleeFnType == ArmStreaming) { + if (AnyScalableArgs) + Diag(Loc, + diag::warn_sme_non_streaming_caller_pass_args_to_streaming); + if (FD->getReturnType()->isSizelessVectorType()) + Diag(Loc, diag::warn_sme_non_streaming_caller_returns_to_streaming); + } + } else if (CalleeFnType != ArmStreaming) { ---------------- sdesmalen-arm wrote:
This logic is not correct, because the following example should not result in a warning. ``` void sc_f(sv_ty arg) __arm_streaming_compatible; void test_s_to_sc2(sv_ty arg) __arm_streaming { sc_f(arg); }``` https://github.com/llvm/llvm-project/pull/79842 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits