@@ -70,40 +70,15 @@ static Attr *handleSuppressAttr(Sema &S, Stmt *St, const ParsedAttr &A,
70
70
71
71
template <typename FPGALoopAttrT>
72
72
static Attr *handleIntelFPGALoopAttr (Sema &S, Stmt *St, const ParsedAttr &A) {
73
- if (!isa<ForStmt, CXXForRangeStmt, DoStmt, WhileStmt>(St)) {
74
- S.Diag (A.getLoc (), diag::err_attribute_wrong_decl_type_str)
75
- << A << " 'for', 'while', and 'do' statements" ;
76
- return nullptr ;
77
- }
78
-
79
- unsigned NumArgs = A.getNumArgs ();
80
- if (NumArgs == 0 ) {
81
- if (A.getKind () == ParsedAttr::AT_SYCLIntelFPGAInitiationInterval ||
82
- A.getKind () == ParsedAttr::AT_SYCLIntelFPGAMaxConcurrency ||
83
- A.getKind () == ParsedAttr::AT_SYCLIntelFPGAMaxInterleaving ||
84
- A.getKind () == ParsedAttr::AT_SYCLIntelFPGASpeculatedIterations) {
85
- S.Diag (A.getLoc (), diag::warn_attribute_too_few_arguments) << A << 1 ;
86
- return nullptr ;
87
- }
88
- }
89
-
90
73
S.CheckDeprecatedSYCLAttributeSpelling (A);
91
74
92
75
return S.BuildSYCLIntelFPGALoopAttr <FPGALoopAttrT>(
93
76
A, A.getNumArgs () ? A.getArgAsExpr (0 ) : nullptr );
94
77
}
95
78
96
- template <>
97
- Attr *handleIntelFPGALoopAttr<SYCLIntelFPGADisableLoopPipeliningAttr>(
98
- Sema &S, Stmt *St, const ParsedAttr &A) {
99
- if (!isa<ForStmt, CXXForRangeStmt, DoStmt, WhileStmt>(St)) {
100
- S.Diag (A.getLoc (), diag::err_attribute_wrong_decl_type_str)
101
- << A << " 'for', 'while', and 'do' statements" ;
102
- return nullptr ;
103
- }
104
-
79
+ static Attr *handleSYCLIntelFPGADisableLoopPipeliningAttr (Sema &S, Stmt *,
80
+ const ParsedAttr &A) {
105
81
S.CheckDeprecatedSYCLAttributeSpelling (A);
106
-
107
82
return new (S.Context ) SYCLIntelFPGADisableLoopPipeliningAttr (S.Context , A);
108
83
}
109
84
@@ -259,12 +234,6 @@ CheckRedundantSYCLIntelFPGAIVDepAttrs(Sema &S, ArrayRef<const Attr *> Attrs) {
259
234
}
260
235
261
236
static Attr *handleIntelFPGAIVDepAttr (Sema &S, Stmt *St, const ParsedAttr &A) {
262
- if (!isa<ForStmt, CXXForRangeStmt, DoStmt, WhileStmt>(St)) {
263
- S.Diag (A.getLoc (), diag::err_attribute_wrong_decl_type_str)
264
- << A << " 'for', 'while', and 'do' statements" ;
265
- return nullptr ;
266
- }
267
-
268
237
unsigned NumArgs = A.getNumArgs ();
269
238
270
239
S.CheckDeprecatedSYCLAttributeSpelling (A);
@@ -276,12 +245,6 @@ static Attr *handleIntelFPGAIVDepAttr(Sema &S, Stmt *St, const ParsedAttr &A) {
276
245
277
246
static Attr *handleIntelFPGANofusionAttr (Sema &S, Stmt *St,
278
247
const ParsedAttr &A) {
279
- if (!isa<ForStmt, CXXForRangeStmt, DoStmt, WhileStmt>(St)) {
280
- S.Diag (A.getLoc (), diag::err_attribute_wrong_decl_type_str)
281
- << A << " 'for', 'while', and 'do' statements" ;
282
- return nullptr ;
283
- }
284
-
285
248
return new (S.Context ) SYCLIntelFPGANofusionAttr (S.Context , A);
286
249
}
287
250
@@ -700,28 +663,13 @@ static Attr *handleLoopUnrollHint(Sema &S, Stmt *St, const ParsedAttr &A,
700
663
// determines unrolling factor) or 1 argument (the unroll factor provided
701
664
// by the user).
702
665
703
- if (!isa<ForStmt, CXXForRangeStmt, DoStmt, WhileStmt>(St)) {
704
- S.Diag (A.getLoc (), diag::err_attribute_wrong_decl_type_str)
705
- << A << " 'for', 'while', and 'do' statements" ;
706
- return nullptr ;
707
- }
708
-
709
666
Expr *E = A.getNumArgs () ? A.getArgAsExpr (0 ) : nullptr ;
710
667
if (A.getParsedKind () == ParsedAttr::AT_OpenCLUnrollHint)
711
668
return S.BuildOpenCLLoopUnrollHintAttr (A, E);
712
- else if (A.getParsedKind () == ParsedAttr::AT_LoopUnrollHint) {
713
- // FIXME: this should be hoisted up to the top level, but can't be placed
714
- // there until the opencl attribute has its parsing error converted into a
715
- // semantic error. See: Parser::ParseOpenCLUnrollHintAttribute().
716
- if (!isa<ForStmt, CXXForRangeStmt, DoStmt, WhileStmt>(St)) {
717
- S.Diag (A.getLoc (), diag::err_attribute_wrong_decl_type_str)
718
- << A << " 'for', 'while', and 'do' statements" ;
719
- return nullptr ;
720
- }
669
+ if (A.getParsedKind () == ParsedAttr::AT_LoopUnrollHint)
721
670
return S.BuildLoopUnrollHintAttr (A, E);
722
- }
723
671
724
- return nullptr ;
672
+ llvm_unreachable ( " Unknown loop unroll hint " ) ;
725
673
}
726
674
727
675
static Attr *ProcessStmtAttribute (Sema &S, Stmt *St, const ParsedAttr &A,
@@ -762,8 +710,7 @@ static Attr *ProcessStmtAttribute(Sema &S, Stmt *St, const ParsedAttr &A,
762
710
case ParsedAttr::AT_SYCLIntelFPGALoopCoalesce:
763
711
return handleIntelFPGALoopAttr<SYCLIntelFPGALoopCoalesceAttr>(S, St, A);
764
712
case ParsedAttr::AT_SYCLIntelFPGADisableLoopPipelining:
765
- return handleIntelFPGALoopAttr<SYCLIntelFPGADisableLoopPipeliningAttr>(
766
- S, St, A);
713
+ return handleSYCLIntelFPGADisableLoopPipeliningAttr (S, St, A);
767
714
case ParsedAttr::AT_SYCLIntelFPGAMaxInterleaving:
768
715
return handleIntelFPGALoopAttr<SYCLIntelFPGAMaxInterleavingAttr>(S, St, A);
769
716
case ParsedAttr::AT_SYCLIntelFPGASpeculatedIterations:
0 commit comments