Skip to content

Commit 950bb09

Browse files
Dinar TemirbulatovDinar Temirbulatov
authored andcommitted
Revert "[Clang][AArch64] Warn when calling non/streaming about vector size difference (#79842)"
This reverts commit 4e85e1f
1 parent 458328a commit 950bb09

File tree

6 files changed

+5
-184
lines changed

6 files changed

+5
-184
lines changed

clang/include/clang/Basic/DiagnosticGroups.td

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1412,9 +1412,6 @@ def MultiGPU: DiagGroup<"multi-gpu">;
14121412
// libc and the CRT to be skipped.
14131413
def AVRRtlibLinkingQuirks : DiagGroup<"avr-rtlib-linking-quirks">;
14141414

1415-
// A warning group related to AArch64 SME function attribues.
1416-
def AArch64SMEAttributes : DiagGroup<"aarch64-sme-attributes">;
1417-
14181415
// A warning group for things that will change semantics in the future.
14191416
def FutureCompat : DiagGroup<"future-compat">;
14201417

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3751,16 +3751,6 @@ def err_sme_definition_using_za_in_non_sme_target : Error<
37513751
"function using ZA state requires 'sme'">;
37523752
def err_sme_definition_using_zt0_in_non_sme2_target : Error<
37533753
"function using ZT0 state requires 'sme2'">;
3754-
def warn_sme_streaming_pass_return_vl_to_non_streaming : Warning<
3755-
"passing a VL-dependent argument to/from a function that has a different"
3756-
" streaming-mode. The streaming and non-streaming vector lengths may be"
3757-
" different">,
3758-
InGroup<AArch64SMEAttributes>, DefaultIgnore;
3759-
def warn_sme_locally_streaming_has_vl_args_returns : Warning<
3760-
"passing/returning a VL-dependent argument to/from a __arm_locally_streaming"
3761-
" function. The streaming and non-streaming vector"
3762-
" lengths may be different">,
3763-
InGroup<AArch64SMEAttributes>, DefaultIgnore;
37643754
def err_conflicting_attributes_arm_state : Error<
37653755
"conflicting attributes for state '%0'">;
37663756
def err_sme_streaming_cannot_be_multiversioned : Error<

clang/lib/Sema/SemaChecking.cpp

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -7949,7 +7949,6 @@ void Sema::checkCall(NamedDecl *FDecl, const FunctionProtoType *Proto,
79497949
// For variadic functions, we may have more args than parameters.
79507950
// For some K&R functions, we may have less args than parameters.
79517951
const auto N = std::min<unsigned>(Proto->getNumParams(), Args.size());
7952-
bool AnyScalableArgsOrRet = Proto->getReturnType()->isSizelessVectorType();
79537952
for (unsigned ArgIdx = 0; ArgIdx < N; ++ArgIdx) {
79547953
// Args[ArgIdx] can be null in malformed code.
79557954
if (const Expr *Arg = Args[ArgIdx]) {
@@ -7963,8 +7962,6 @@ void Sema::checkCall(NamedDecl *FDecl, const FunctionProtoType *Proto,
79637962
checkAIXMemberAlignment((Arg->getExprLoc()), Arg);
79647963

79657964
QualType ParamTy = Proto->getParamType(ArgIdx);
7966-
if (ParamTy->isSizelessVectorType())
7967-
AnyScalableArgsOrRet = true;
79687965
QualType ArgTy = Arg->getType();
79697966
CheckArgAlignment(Arg->getExprLoc(), FDecl, std::to_string(ArgIdx + 1),
79707967
ArgTy, ParamTy);
@@ -7985,23 +7982,6 @@ void Sema::checkCall(NamedDecl *FDecl, const FunctionProtoType *Proto,
79857982
}
79867983
}
79877984

7988-
// If the call requires a streaming-mode change and has scalable vector
7989-
// arguments or return values, then warn the user that the streaming and
7990-
// non-streaming vector lengths may be different.
7991-
const auto *CallerFD = dyn_cast<FunctionDecl>(CurContext);
7992-
if (CallerFD && (!FD || !FD->getBuiltinID()) && AnyScalableArgsOrRet) {
7993-
bool IsCalleeStreaming =
7994-
ExtInfo.AArch64SMEAttributes & FunctionType::SME_PStateSMEnabledMask;
7995-
bool IsCalleeStreamingCompatible =
7996-
ExtInfo.AArch64SMEAttributes &
7997-
FunctionType::SME_PStateSMCompatibleMask;
7998-
ArmStreamingType CallerFnType = getArmStreamingFnType(CallerFD);
7999-
if (!IsCalleeStreamingCompatible &&
8000-
(CallerFnType == ArmStreamingCompatible ||
8001-
((CallerFnType == ArmStreaming) ^ IsCalleeStreaming)))
8002-
Diag(Loc, diag::warn_sme_streaming_pass_return_vl_to_non_streaming);
8003-
}
8004-
80057985
FunctionType::ArmStateValue CalleeArmZAState =
80067986
FunctionType::getArmZAState(ExtInfo.AArch64SMEAttributes);
80077987
FunctionType::ArmStateValue CalleeArmZT0State =
@@ -8010,7 +7990,7 @@ void Sema::checkCall(NamedDecl *FDecl, const FunctionProtoType *Proto,
80107990
CalleeArmZT0State != FunctionType::ARM_None) {
80117991
bool CallerHasZAState = false;
80127992
bool CallerHasZT0State = false;
8013-
if (CallerFD) {
7993+
if (const auto *CallerFD = dyn_cast<FunctionDecl>(CurContext)) {
80147994
auto *Attr = CallerFD->getAttr<ArmNewAttr>();
80157995
if (Attr && Attr->isNewZA())
80167996
CallerHasZAState = true;

clang/lib/Sema/SemaDecl.cpp

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12408,22 +12408,12 @@ bool Sema::CheckFunctionDeclaration(Scope *S, FunctionDecl *NewFD,
1240812408
}
1240912409

1241012410
// Check if the function definition uses any AArch64 SME features without
12411-
// having the '+sme' feature enabled and warn user if sme locally streaming
12412-
// function returns or uses arguments with VL-based types.
12411+
// having the '+sme' feature enabled.
1241312412
if (DeclIsDefn) {
1241412413
const auto *Attr = NewFD->getAttr<ArmNewAttr>();
1241512414
bool UsesSM = NewFD->hasAttr<ArmLocallyStreamingAttr>();
1241612415
bool UsesZA = Attr && Attr->isNewZA();
1241712416
bool UsesZT0 = Attr && Attr->isNewZT0();
12418-
12419-
if (NewFD->hasAttr<ArmLocallyStreamingAttr>()) {
12420-
if (NewFD->getReturnType()->isSizelessVectorType() ||
12421-
llvm::any_of(NewFD->parameters(), [](ParmVarDecl *P) {
12422-
return P->getOriginalType()->isSizelessVectorType();
12423-
}))
12424-
Diag(NewFD->getLocation(),
12425-
diag::warn_sme_locally_streaming_has_vl_args_returns);
12426-
}
1242712417
if (const auto *FPT = NewFD->getType()->getAs<FunctionProtoType>()) {
1242812418
FunctionProtoType::ExtProtoInfo EPI = FPT->getExtProtoInfo();
1242912419
UsesSM |=

clang/test/Sema/aarch64-incompat-sm-builtin-calls.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py
22
// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve \
3-
// RUN: -target-feature +sme2 -target-feature +sve2 -target-feature +neon -Waarch64-sme-attributes -fsyntax-only -verify %s
3+
// RUN: -target-feature +sme2 -target-feature +sve2 -target-feature +neon -fsyntax-only -verify %s
44

55
// REQUIRES: aarch64-registered-target
66

@@ -33,7 +33,6 @@ svuint32_t incompat_sve_sm(svbool_t pg, svuint32_t a, int16_t b) __arm_streaming
3333
return __builtin_sve_svld1_gather_u32base_index_u32(pg, a, b);
3434
}
3535

36-
// expected-warning@+1 {{passing/returning a VL-dependent argument to/from a __arm_locally_streaming function. The streaming and non-streaming vector lengths may be different}}
3736
__arm_locally_streaming svuint32_t incompat_sve_ls(svbool_t pg, svuint32_t a, int64_t b) {
3837
// expected-warning@+1 {{builtin call has undefined behaviour when called from a streaming function}}
3938
return __builtin_sve_svld1_gather_u32base_index_u32(pg, a, b);
@@ -49,7 +48,6 @@ svuint32_t incompat_sve2_sm(svbool_t pg, svuint32_t a, int64_t b) __arm_streamin
4948
return __builtin_sve_svldnt1_gather_u32base_index_u32(pg, a, b);
5049
}
5150

52-
// expected-warning@+1 {{passing/returning a VL-dependent argument to/from a __arm_locally_streaming function. The streaming and non-streaming vector lengths may be different}}
5351
__arm_locally_streaming svuint32_t incompat_sve2_ls(svbool_t pg, svuint32_t a, int64_t b) {
5452
// expected-warning@+1 {{builtin call has undefined behaviour when called from a streaming function}}
5553
return __builtin_sve_svldnt1_gather_u32base_index_u32(pg, a, b);
@@ -70,7 +68,6 @@ svfloat64_t streaming_caller_sve(svbool_t pg, svfloat64_t a, float64_t b) __arm_
7068
return svadd_n_f64_m(pg, a, b);
7169
}
7270

73-
// expected-warning@+1 {{passing/returning a VL-dependent argument to/from a __arm_locally_streaming function. The streaming and non-streaming vector lengths may be different}}
7471
__arm_locally_streaming svfloat64_t locally_streaming_caller_sve(svbool_t pg, svfloat64_t a, float64_t b) {
7572
// expected-no-warning
7673
return svadd_n_f64_m(pg, a, b);
@@ -86,7 +83,6 @@ svint16_t streaming_caller_sve2(svint16_t op1, svint16_t op2) __arm_streaming {
8683
return svmul_lane_s16(op1, op2, 0);
8784
}
8885

89-
// expected-warning@+1 {{passing/returning a VL-dependent argument to/from a __arm_locally_streaming function. The streaming and non-streaming vector lengths may be different}}
9086
__arm_locally_streaming svint16_t locally_streaming_caller_sve2(svint16_t op1, svint16_t op2) {
9187
// expected-no-warning
9288
return svmul_lane_s16(op1, op2, 0);

clang/test/Sema/aarch64-sme-func-attrs.c

Lines changed: 2 additions & 134 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -target-feature +sve -Waarch64-sme-attributes -fsyntax-only -verify %s
2-
// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -target-feature +sve -Waarch64-sme-attributes -fsyntax-only -verify=expected-cpp -x c++ %s
1+
// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -fsyntax-only -verify %s
2+
// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -fsyntax-only -verify=expected-cpp -x c++ %s
33

44
// Valid attributes
55

@@ -496,135 +496,3 @@ void fmv_caller() {
496496
just_fine();
497497
incompatible_locally_streaming();
498498
}
499-
500-
void sme_streaming_with_vl_arg(__SVInt8_t a) __arm_streaming { }
501-
502-
__SVInt8_t sme_streaming_returns_vl(void) __arm_streaming { __SVInt8_t r; return r; }
503-
504-
void sme_streaming_compatible_with_vl_arg(__SVInt8_t a) __arm_streaming_compatible { }
505-
506-
__SVInt8_t sme_streaming_compatible_returns_vl(void) __arm_streaming_compatible { __SVInt8_t r; return r; }
507-
508-
void sme_no_streaming_with_vl_arg(__SVInt8_t a) { }
509-
510-
__SVInt8_t sme_no_streaming_returns_vl(void) { __SVInt8_t r; return r; }
511-
512-
// expected-warning@+2 {{passing/returning a VL-dependent argument to/from a __arm_locally_streaming function. The streaming and non-streaming vector lengths may be different}}
513-
// expected-cpp-warning@+1 {{passing/returning a VL-dependent argument to/from a __arm_locally_streaming function. The streaming and non-streaming vector lengths may be different}}
514-
__arm_locally_streaming void sme_locally_streaming_with_vl_arg(__SVInt8_t a) { }
515-
516-
// expected-warning@+2 {{passing/returning a VL-dependent argument to/from a __arm_locally_streaming function. The streaming and non-streaming vector lengths may be different}}
517-
// expected-cpp-warning@+1 {{passing/returning a VL-dependent argument to/from a __arm_locally_streaming function. The streaming and non-streaming vector lengths may be different}}
518-
__arm_locally_streaming __SVInt8_t sme_locally_streaming_returns_vl(void) { __SVInt8_t r; return r; }
519-
520-
void sme_no_streaming_calling_streaming_with_vl_args() {
521-
__SVInt8_t a;
522-
// expected-warning@+2 {{passing a VL-dependent argument to/from a function that has a different streaming-mode. The streaming and non-streaming vector lengths may be different}}
523-
// expected-cpp-warning@+1 {{passing a VL-dependent argument to/from a function that has a different streaming-mode. The streaming and non-streaming vector lengths may be different}}
524-
sme_streaming_with_vl_arg(a);
525-
}
526-
527-
void sme_no_streaming_calling_streaming_with_return_vl() {
528-
// expected-warning@+2 {{passing a VL-dependent argument to/from a function that has a different streaming-mode. The streaming and non-streaming vector lengths may be different}}
529-
// expected-cpp-warning@+1 {{passing a VL-dependent argument to/from a function that has a different streaming-mode. The streaming and non-streaming vector lengths may be different}}
530-
__SVInt8_t r = sme_streaming_returns_vl();
531-
}
532-
533-
void sme_streaming_calling_non_streaming_with_vl_args(void) __arm_streaming {
534-
__SVInt8_t a;
535-
// expected-warning@+2 {{passing a VL-dependent argument to/from a function that has a different streaming-mode. The streaming and non-streaming vector lengths may be different}}
536-
// expected-cpp-warning@+1 {{passing a VL-dependent argument to/from a function that has a different streaming-mode. The streaming and non-streaming vector lengths may be different}}
537-
sme_no_streaming_with_vl_arg(a);
538-
}
539-
540-
void sme_streaming_calling_non_streaming_with_return_vl(void) __arm_streaming {
541-
// expected-warning@+2 {{passing a VL-dependent argument to/from a function that has a different streaming-mode. The streaming and non-streaming vector lengths may be different}}
542-
// expected-cpp-warning@+1 {{passing a VL-dependent argument to/from a function that has a different streaming-mode. The streaming and non-streaming vector lengths may be different}}
543-
__SVInt8_t r = sme_no_streaming_returns_vl();
544-
}
545-
546-
void sme_no_streaming_calling_streaming_with_vl_args_param(__SVInt8_t arg, void (*sc)( __SVInt8_t arg) __arm_streaming) {
547-
// expected-warning@+2 {{passing a VL-dependent argument to/from a function that has a different streaming-mode. The streaming and non-streaming vector lengths may be different}}
548-
// expected-cpp-warning@+1 {{passing a VL-dependent argument to/from a function that has a different streaming-mode. The streaming and non-streaming vector lengths may be different}}
549-
sc(arg);
550-
}
551-
552-
__SVInt8_t sme_no_streaming_calling_streaming_return_vl_param(__SVInt8_t (*s)(void) __arm_streaming) {
553-
// expected-warning@+2 {{passing a VL-dependent argument to/from a function that has a different streaming-mode. The streaming and non-streaming vector lengths may be different}}
554-
// expected-cpp-warning@+1 {{passing a VL-dependent argument to/from a function that has a different streaming-mode. The streaming and non-streaming vector lengths may be different}}
555-
return s();
556-
}
557-
558-
void sme_streaming_compatible_calling_streaming_with_vl_args(__SVInt8_t arg) __arm_streaming_compatible {
559-
// expected-warning@+2 {{passing a VL-dependent argument to/from a function that has a different streaming-mode. The streaming and non-streaming vector lengths may be different}}
560-
// expected-cpp-warning@+1 {{passing a VL-dependent argument to/from a function that has a different streaming-mode. The streaming and non-streaming vector lengths may be different}}
561-
sme_streaming_with_vl_arg(arg);
562-
}
563-
564-
void sme_streaming_compatible_calling_sme_streaming_return_vl(void) __arm_streaming_compatible {
565-
// expected-warning@+2 {{passing a VL-dependent argument to/from a function that has a different streaming-mode. The streaming and non-streaming vector lengths may be different}}
566-
// expected-cpp-warning@+1 {{passing a VL-dependent argument to/from a function that has a different streaming-mode. The streaming and non-streaming vector lengths may be different}}
567-
__SVInt8_t r = sme_streaming_returns_vl();
568-
}
569-
570-
void sme_streaming_compatible_calling_no_streaming_with_vl_args(__SVInt8_t arg) __arm_streaming_compatible {
571-
// expected-warning@+2 {{passing a VL-dependent argument to/from a function that has a different streaming-mode. The streaming and non-streaming vector lengths may be different}}
572-
// expected-cpp-warning@+1 {{passing a VL-dependent argument to/from a function that has a different streaming-mode. The streaming and non-streaming vector lengths may be different}}
573-
sme_no_streaming_with_vl_arg(arg);
574-
}
575-
576-
void sme_streaming_compatible_calling_no_sme_streaming_return_vl(void) __arm_streaming_compatible {
577-
// expected-warning@+2 {{passing a VL-dependent argument to/from a function that has a different streaming-mode. The streaming and non-streaming vector lengths may be different}}
578-
// expected-cpp-warning@+1 {{passing a VL-dependent argument to/from a function that has a different streaming-mode. The streaming and non-streaming vector lengths may be different}}
579-
__SVInt8_t r = sme_no_streaming_returns_vl();
580-
}
581-
582-
void sme_streaming_calling_streaming(__SVInt8_t arg, void (*s)( __SVInt8_t arg) __arm_streaming) __arm_streaming {
583-
s(arg);
584-
}
585-
586-
__SVInt8_t sme_streaming_calling_streaming_return_vl(__SVInt8_t (*s)(void) __arm_streaming) __arm_streaming {
587-
return s();
588-
}
589-
590-
void sme_streaming_calling_streaming_with_vl_args(__SVInt8_t a) __arm_streaming {
591-
sme_streaming_with_vl_arg(a);
592-
}
593-
594-
void sme_streaming_calling_streaming_with_return_vl(void) __arm_streaming {
595-
__SVInt8_t r = sme_streaming_returns_vl();
596-
}
597-
598-
void sme_streaming_calling_streaming_compatible_with_vl_args(__SVInt8_t a) __arm_streaming {
599-
sme_streaming_compatible_with_vl_arg(a);
600-
}
601-
602-
void sme_streaming_calling_streaming_compatible_with_return_vl(void) __arm_streaming {
603-
__SVInt8_t r = sme_streaming_compatible_returns_vl();
604-
}
605-
606-
void sme_no_streaming_calling_streaming_compatible_with_vl_args() {
607-
__SVInt8_t a;
608-
sme_streaming_compatible_with_vl_arg(a);
609-
}
610-
611-
void sme_no_streaming_calling_streaming_compatible_with_return_vl() {
612-
__SVInt8_t r = sme_streaming_compatible_returns_vl();
613-
}
614-
615-
void sme_no_streaming_calling_non_streaming_compatible_with_vl_args() {
616-
__SVInt8_t a;
617-
sme_no_streaming_with_vl_arg(a);
618-
}
619-
620-
void sme_no_streaming_calling_non_streaming_compatible_with_return_vl() {
621-
__SVInt8_t r = sme_no_streaming_returns_vl();
622-
}
623-
624-
void sme_streaming_compatible_calling_streaming_compatible_with_vl_args(__SVInt8_t arg) __arm_streaming_compatible {
625-
sme_streaming_compatible_with_vl_arg(arg);
626-
}
627-
628-
void sme_streaming_compatible_calling_streaming_compatible_with_return_vl(void) __arm_streaming_compatible {
629-
__SVInt8_t r = sme_streaming_compatible_returns_vl();
630-
}

0 commit comments

Comments
 (0)