@@ -357,7 +357,7 @@ class DiagDeviceFunction : public RecursiveASTVisitor<DiagDeviceFunction> {
357
357
// diagnostics.
358
358
unsigned ConstexprDepth = 0 ;
359
359
Sema &SemaRef;
360
- const llvm::SmallPtrSetImpl<FunctionDecl *> &RecursiveFuncs;
360
+ const llvm::SmallPtrSetImpl<const FunctionDecl *> &RecursiveFuncs;
361
361
362
362
struct ConstexprDepthRAII {
363
363
DiagDeviceFunction &DDF;
@@ -376,7 +376,8 @@ class DiagDeviceFunction : public RecursiveASTVisitor<DiagDeviceFunction> {
376
376
377
377
public:
378
378
DiagDeviceFunction (
379
- Sema &S, const llvm::SmallPtrSetImpl<FunctionDecl *> &RecursiveFuncs)
379
+ Sema &S,
380
+ const llvm::SmallPtrSetImpl<const FunctionDecl *> &RecursiveFuncs)
380
381
: RecursiveASTVisitor(), SemaRef(S), RecursiveFuncs(RecursiveFuncs) {}
381
382
382
383
void CheckBody (Stmt *ToBeDiagnosed) { TraverseStmt (ToBeDiagnosed); }
@@ -498,7 +499,7 @@ class DeviceFunctionTracker {
498
499
// The list of functions used on the device, kept so we can diagnose on them
499
500
// later.
500
501
llvm::SmallPtrSet<FunctionDecl *, 16 > DeviceFunctions;
501
- llvm::SmallPtrSet<FunctionDecl *, 16 > RecursiveFunctions;
502
+ llvm::SmallPtrSet<const FunctionDecl *, 16 > RecursiveFunctions;
502
503
503
504
void CollectSyclExternalFuncs () {
504
505
for (CallGraphNode::CallRecord Record : CG.getRoot ()->callees ())
@@ -512,9 +513,9 @@ class DeviceFunctionTracker {
512
513
return CG.getNode (Kernel);
513
514
}
514
515
515
- void
516
- AddSingleFunction ( const llvm::SmallPtrSetImpl<FunctionDecl *> &DevFuncs,
517
- const llvm::SmallPtrSetImpl<FunctionDecl *> &Recursive) {
516
+ void AddSingleFunction (
517
+ const llvm::SmallPtrSetImpl<FunctionDecl *> &DevFuncs,
518
+ const llvm::SmallPtrSetImpl<const FunctionDecl *> &Recursive) {
518
519
DeviceFunctions.insert (DevFuncs.begin (), DevFuncs.end ());
519
520
RecursiveFunctions.insert (Recursive.begin (), Recursive.end ());
520
521
}
@@ -545,7 +546,7 @@ class SingleDeviceFunctionTracker {
545
546
FunctionDecl *SYCLKernel = nullptr ;
546
547
FunctionDecl *KernelBody = nullptr ;
547
548
llvm::SmallPtrSet<FunctionDecl *, 16 > DeviceFunctions;
548
- llvm::SmallPtrSet<FunctionDecl *, 16 > RecursiveFunctions;
549
+ llvm::SmallPtrSet<const FunctionDecl *, 16 > RecursiveFunctions;
549
550
llvm::SmallVector<Attr *> CollectedAttributes;
550
551
551
552
FunctionDecl *GetFDFromNode (CallGraphNode *Node) {
@@ -3565,6 +3566,17 @@ static void PropagateAndDiagnoseDeviceAttr(Sema &S, Attr *A,
3565
3566
}
3566
3567
break ;
3567
3568
}
3569
+ case attr::Kind::SYCLSimd:
3570
+ if (KernelBody && !KernelBody->getAttr <SYCLSimdAttr>()) {
3571
+ // Usual kernel can't call ESIMD functions.
3572
+ S.Diag (KernelBody->getLocation (),
3573
+ diag::err_sycl_function_attribute_mismatch)
3574
+ << A;
3575
+ S.Diag (A->getLocation (), diag::note_attribute);
3576
+ KernelBody->setInvalidDecl ();
3577
+ break ;
3578
+ }
3579
+ LLVM_FALLTHROUGH;
3568
3580
case attr::Kind::SYCLIntelKernelArgsRestrict:
3569
3581
case attr::Kind::SYCLIntelNumSimdWorkItems:
3570
3582
case attr::Kind::SYCLIntelSchedulerTargetFmaxMhz:
@@ -3575,19 +3587,8 @@ static void PropagateAndDiagnoseDeviceAttr(Sema &S, Attr *A,
3575
3587
case attr::Kind::SYCLIntelFPGAMaxConcurrency:
3576
3588
case attr::Kind::SYCLIntelFPGADisableLoopPipelining:
3577
3589
case attr::Kind::SYCLIntelFPGAInitiationInterval:
3578
- case attr::Kind::SYCLSimd: {
3579
- if ((A->getKind () == attr::Kind::SYCLSimd) && KernelBody &&
3580
- !KernelBody->getAttr <SYCLSimdAttr>()) {
3581
- // Usual kernel can't call ESIMD functions.
3582
- S.Diag (KernelBody->getLocation (),
3583
- diag::err_sycl_function_attribute_mismatch)
3584
- << A;
3585
- S.Diag (A->getLocation (), diag::note_attribute);
3586
- KernelBody->setInvalidDecl ();
3587
- } else
3588
- SYCLKernel->addAttr (A);
3590
+ SYCLKernel->addAttr (A);
3589
3591
break ;
3590
- }
3591
3592
// TODO: vec_len_hint should be handled here
3592
3593
default :
3593
3594
// Seeing this means that CollectPossibleKernelAttributes was
0 commit comments