@@ -110,23 +110,6 @@ static bool SYCLCUDAIsSYCLDevice(const clang::LangOptions &LangOpts) {
110
110
return LangOpts.SYCLIsDevice && LangOpts.CUDA && !LangOpts.CUDAIsDevice ;
111
111
}
112
112
113
- static bool isSyclType (QualType Ty, SYCLTypeAttr::SYCLType TypeName) {
114
- const auto *RD = Ty->getAsCXXRecordDecl ();
115
- if (!RD)
116
- return false ;
117
-
118
- if (const auto *Attr = RD->getAttr <SYCLTypeAttr>())
119
- return Attr->getType () == TypeName;
120
-
121
- if (const auto *CTSD = dyn_cast<ClassTemplateSpecializationDecl>(RD))
122
- if (CXXRecordDecl *TemplateDecl =
123
- CTSD->getSpecializedTemplate ()->getTemplatedDecl ())
124
- if (const auto *Attr = TemplateDecl->getAttr <SYCLTypeAttr>())
125
- return Attr->getType () == TypeName;
126
-
127
- return false ;
128
- }
129
-
130
113
CodeGenModule::CodeGenModule (ASTContext &C,
131
114
IntrusiveRefCntPtr<llvm::vfs::FileSystem> FS,
132
115
const HeaderSearchOptions &HSO,
@@ -5525,20 +5508,22 @@ void CodeGenModule::EmitGlobalVarDefinition(const VarDecl *D,
5525
5508
5526
5509
if (getLangOpts ().SYCLIsDevice ) {
5527
5510
const RecordDecl *RD = D->getType ()->getAsRecordDecl ();
5528
- // Add IR attributes if add_ir_attribute_global_variable is attached to
5529
- // type.
5530
- if (RD && RD->hasAttr <SYCLAddIRAttributesGlobalVariableAttr>())
5531
- AddGlobalSYCLIRAttributes (GV, RD);
5532
- // If VarDecl has a type decorated with SYCL device_global attribute
5533
- // emit IR attribute 'sycl-unique-id'.
5534
- if (RD && (RD->hasAttr <SYCLDeviceGlobalAttr>()))
5535
- addSYCLUniqueID (GV, D, Context);
5536
-
5537
- // If VarDecl type is SYCLTypeAttr::host_pipe, emit the IR attribute
5538
- // 'sycl-unique-id'.
5539
- auto Ty = D->getType ();
5540
- if (isSyclType (Ty, SYCLTypeAttr::host_pipe))
5541
- addSYCLUniqueID (GV, D, Context);
5511
+
5512
+ if (RD) {
5513
+ // Add IR attributes if add_ir_attribute_global_variable is attached to
5514
+ // type.
5515
+ if (RD->hasAttr <SYCLAddIRAttributesGlobalVariableAttr>())
5516
+ AddGlobalSYCLIRAttributes (GV, RD);
5517
+ // If VarDecl has a type decorated with SYCL device_global attribute
5518
+ // emit IR attribute 'sycl-unique-id'.
5519
+ if (RD->hasAttr <SYCLDeviceGlobalAttr>())
5520
+ addSYCLUniqueID (GV, D, Context);
5521
+ // If VarDecl type is SYCLTypeAttr::host_pipe, emit the IR attribute
5522
+ // 'sycl-unique-id'.
5523
+ if (const auto *Attr = RD->getAttr <SYCLTypeAttr>())
5524
+ if (Attr->getType () == SYCLTypeAttr::SYCLType::host_pipe)
5525
+ addSYCLUniqueID (GV, D, Context);
5526
+ }
5542
5527
}
5543
5528
5544
5529
if (D->getType ().isRestrictQualified ()) {
0 commit comments