[clang] [Sema][AArch64] Emit error for mismatched VLs on streaming mode transitions (PR #159131)
Sander de Smalen via cfe-commits
cfe-commits at lists.llvm.org
Thu Sep 18 02:07:59 PDT 2025
================
@@ -3771,25 +3771,25 @@ void Sema::checkCall(NamedDecl *FDecl, const FunctionProtoType *Proto,
(CallerFnType == SemaARM::ArmStreamingCompatible ||
((CallerFnType == SemaARM::ArmStreaming) ^ IsCalleeStreaming))) {
const LangOptions &LO = getLangOpts();
- auto VL = LO.VScaleMin * 128;
- auto SVL = LO.VScaleStreamingMin * 128;
+ unsigned VL = LO.VScaleMin * 128;
+ unsigned SVL = LO.VScaleStreamingMin * 128;
- if (IsScalableArg) {
- if (VL && SVL && VL != SVL)
- Diag(Loc, diag::err_sme_streaming_transition_vl_mismatch)
- << /*IsArg=*/true << VL << SVL;
- else
- Diag(Loc, diag::warn_sme_streaming_pass_return_vl_to_non_streaming)
- << /*IsArg=*/true;
- }
- if (IsScalableRet) {
- if (VL && SVL && VL != SVL)
+ bool IsVLError = CallerFnType != SemaARM::ArmStreamingCompatible &&
----------------
sdesmalen-arm wrote:
I think it's worth making a special warning diagnostic for the streaming-compatible -> streaming case, and the streaming-compatible -> non-streaming case when we know that VL != SVL, to make it clear that passing a VL-dependent argument may be undefined behaviour if the machine is [not] in streaming mode when executing the call.
(This is subtly different from the current warning diagnostic which says that passing a VL-dependent argument may be undefined behaviour if the vector lengths don't match)
https://github.com/llvm/llvm-project/pull/159131
More information about the cfe-commits
mailing list