@@ -753,57 +753,6 @@ void SemaSYCL::addSYCLIntelPipeIOAttr(Decl *D, const AttributeCommonInfo &CI,
753753 D->addAttr (::new (Context) SYCLIntelPipeIOAttr (Context, CI, E));
754754}
755755
756- // Handles [[intel::loop_fuse]] and [[intel::loop_fuse_independent]].
757- void SemaSYCL::addSYCLIntelLoopFuseAttr (Decl *D, const AttributeCommonInfo &CI,
758- Expr *E) {
759- if (!E->isValueDependent ()) {
760- // Validate that we have an integer constant expression and then store the
761- // converted constant expression into the semantic attribute so that we
762- // don't have to evaluate it again later.
763- llvm::APSInt ArgVal;
764- ExprResult Res = SemaRef.VerifyIntegerConstantExpression (E, &ArgVal);
765- if (Res.isInvalid ())
766- return ;
767- E = Res.get ();
768-
769- // This attribute requires a non-negative value.
770- if (ArgVal < 0 ) {
771- Diag (E->getExprLoc (), diag::err_attribute_requires_positive_integer)
772- << CI << /* non-negative*/ 1 ;
773- return ;
774- }
775- // Check to see if there's a duplicate attribute with different values
776- // already applied to the declaration.
777- if (const auto *DeclAttr = D->getAttr <SYCLIntelLoopFuseAttr>()) {
778- // [[intel::loop_fuse]] and [[intel::loop_fuse_independent]] are
779- // incompatible.
780- // FIXME: If additional spellings are provided for this attribute,
781- // this code will do the wrong thing.
782- if (DeclAttr->getAttributeSpellingListIndex () !=
783- CI.getAttributeSpellingListIndex ()) {
784- Diag (CI.getLoc (), diag::err_attributes_are_not_compatible)
785- << CI << DeclAttr << CI.isRegularKeywordAttribute ();
786- Diag (DeclAttr->getLocation (), diag::note_conflicting_attribute);
787- return ;
788- }
789- // If the other attribute argument is instantiation dependent, we won't
790- // have converted it to a constant expression yet and thus we test
791- // whether this is a null pointer.
792- if (const auto *DeclExpr = dyn_cast<ConstantExpr>(DeclAttr->getValue ())) {
793- if (ArgVal != DeclExpr->getResultAsAPSInt ()) {
794- Diag (CI.getLoc (), diag::warn_duplicate_attribute) << CI;
795- Diag (DeclAttr->getLoc (), diag::note_previous_attribute);
796- }
797- // Drop the duplicate attribute.
798- return ;
799- }
800- }
801- }
802-
803- ASTContext &Context = getASTContext ();
804- D->addAttr (::new (Context) SYCLIntelLoopFuseAttr (Context, CI, E));
805- }
806-
807756void SemaSYCL::addIntelReqdSubGroupSizeAttr (Decl *D,
808757 const AttributeCommonInfo &CI,
809758 Expr *E) {
@@ -2353,48 +2302,6 @@ SemaSYCL::mergeSYCLIntelMaxWorkGroupsPerMultiprocessorAttr(
23532302 SYCLIntelMaxWorkGroupsPerMultiprocessorAttr (Context, A, A.getValue ());
23542303}
23552304
2356- void SemaSYCL::handleSYCLIntelLoopFuseAttr (Decl *D, const ParsedAttr &A) {
2357- // If no attribute argument is specified, set to default value '1'.
2358- ASTContext &Context = getASTContext ();
2359- Expr *E = A.isArgExpr (0 ) ? A.getArgAsExpr (0 )
2360- : IntegerLiteral::Create (Context, llvm::APInt (32 , 1 ),
2361- Context.IntTy , A.getLoc ());
2362-
2363- addSYCLIntelLoopFuseAttr (D, A, E);
2364- }
2365-
2366- SYCLIntelLoopFuseAttr *
2367- SemaSYCL::mergeSYCLIntelLoopFuseAttr (Decl *D, const SYCLIntelLoopFuseAttr &A) {
2368- // Check to see if there's a duplicate attribute with different values
2369- // already applied to the declaration.
2370- if (const auto *DeclAttr = D->getAttr <SYCLIntelLoopFuseAttr>()) {
2371- // [[intel::loop_fuse]] and [[intel::loop_fuse_independent]] are
2372- // incompatible.
2373- // FIXME: If additional spellings are provided for this attribute,
2374- // this code will do the wrong thing.
2375- if (DeclAttr->getAttributeSpellingListIndex () !=
2376- A.getAttributeSpellingListIndex ()) {
2377- Diag (A.getLoc (), diag::err_attributes_are_not_compatible)
2378- << &A << DeclAttr << A.isRegularKeywordAttribute ();
2379- Diag (DeclAttr->getLoc (), diag::note_conflicting_attribute);
2380- return nullptr ;
2381- }
2382- if (const auto *DeclExpr = dyn_cast<ConstantExpr>(DeclAttr->getValue ())) {
2383- if (const auto *MergeExpr = dyn_cast<ConstantExpr>(A.getValue ())) {
2384- if (DeclExpr->getResultAsAPSInt () != MergeExpr->getResultAsAPSInt ()) {
2385- Diag (DeclAttr->getLoc (), diag::warn_duplicate_attribute) << &A;
2386- Diag (A.getLoc (), diag::note_previous_attribute);
2387- }
2388- // Do not add a duplicate attribute.
2389- return nullptr ;
2390- }
2391- }
2392- }
2393-
2394- ASTContext &Context = getASTContext ();
2395- return ::new (Context) SYCLIntelLoopFuseAttr (Context, A, A.getValue ());
2396- }
2397-
23982305void SemaSYCL::handleSYCLIntelESimdVectorizeAttr (Decl *D, const ParsedAttr &A) {
23992306 checkDeprecatedSYCLAttributeSpelling (A);
24002307
0 commit comments