@@ -3148,13 +3148,13 @@ static void handleWorkGroupSize(Sema &S, Decl *D, const ParsedAttr &AL) {
31483148 // to the default value 1, but only if the sycl:: or intel::
31493149 // reqd_work_group_size spelling was used.
31503150 auto SetDefaultValue = [](Sema &S, const ParsedAttr &AL, SourceLocation loc) {
3151- Expr *E =
3152- (AL. getKind () == ParsedAttr::AT_ReqdWorkGroupSize && AL.hasScope () &&
3153- ( AL.getScopeName ()->isStr (" sycl " ) ||
3154- AL. getScopeName ()-> isStr ( " intel" )))
3155- ? IntegerLiteral::Create (S. Context , llvm::APInt ( 32 , 1 ),
3156- S.Context . IntTy , AL. getLoc ())
3157- : nullptr ;
3151+ assert ((AL. getKind () == ParsedAttr::AT_ReqdWorkGroupSize && AL. hasScope () &&
3152+ ( AL.getScopeName ()-> isStr ( " sycl " ) ||
3153+ AL.getScopeName ()->isStr (" intel " ))) &&
3154+ " Attribute does not exist in sycl:: or intel:: scope " );
3155+
3156+ Expr *E = IntegerLiteral::Create ( S.Context , llvm::APInt ( 32 , 1 ),
3157+ S. Context . IntTy , AL. getLoc ()) ;
31583158 return E;
31593159 };
31603160
@@ -3176,33 +3176,25 @@ static void handleWorkGroupSize(Sema &S, Decl *D, const ParsedAttr &AL) {
31763176 }
31773177
31783178 ASTContext &Ctx = S.getASTContext ();
3179-
3180- bool YDimExprIsDereferencable = YDimExpr && (!YDimExpr->isValueDependent ());
3181- bool ZDimExprIsDereferencable = ZDimExpr && (!ZDimExpr->isValueDependent ());
3182-
3183- llvm::APSInt XDimVal, YDimVal, ZDimVal;
3184- if (!XDimExpr->isValueDependent ()) {
3179+ if (!XDimExpr->isValueDependent () && !YDimExpr->isValueDependent () &&
3180+ !ZDimExpr->isValueDependent ()) {
3181+ llvm::APSInt XDimVal, YDimVal, ZDimVal;
31853182 ExprResult XDim = S.VerifyIntegerConstantExpression (XDimExpr, &XDimVal);
3183+ ExprResult YDim = S.VerifyIntegerConstantExpression (YDimExpr, &YDimVal);
3184+ ExprResult ZDim = S.VerifyIntegerConstantExpression (ZDimExpr, &ZDimVal);
3185+
31863186 if (XDim.isInvalid ())
31873187 return ;
31883188 XDimExpr = XDim.get ();
3189- }
31903189
3191- if (YDimExprIsDereferencable) {
3192- ExprResult YDim = S.VerifyIntegerConstantExpression (YDimExpr, &YDimVal);
31933190 if (YDim.isInvalid ())
31943191 return ;
31953192 YDimExpr = YDim.get ();
3196- }
31973193
3198- if (ZDimExprIsDereferencable) {
3199- ExprResult ZDim = S.VerifyIntegerConstantExpression (ZDimExpr, &ZDimVal);
32003194 if (ZDim.isInvalid ())
32013195 return ;
32023196 ZDimExpr = ZDim.get ();
3203- }
32043197
3205- if ((XDimVal >= 1 ) && (YDimVal >= 1 ) && (ZDimVal >= 1 )) {
32063198 // If the num_simd_work_items attribute is specified on a declaration it
32073199 // must evenly divide the index that increments fastest in the
32083200 // reqd_work_group_size attribute. In OpenCL, the first argument increments
0 commit comments