================
@@ -6821,6 +6821,19 @@ CodeGenModule::getLLVMLinkageForDeclarator(const 
DeclaratorDecl *D,
   if (Linkage == GVA_AvailableExternally)
     return llvm::GlobalValue::AvailableExternallyLinkage;
 
+  // SYCL device symbols that are not part of the module interface (i.e. not
+  // SYCL kernels and not marked with [[clang::sycl_external]]) are not
+  // externally visible. In RDC mode they are emitted with linkonce_odr linkage
+  // so equivalent definitions can be deduplicated across translation units.
+  // In non-RDC mode the whole device program lives in a single translation
+  // unit, so they are given internal linkage to enable more aggressive
+  // optimization.
+  if (getLangOpts().SYCLIsDevice && !D->hasAttr<SYCLKernelAttr>() &&
+      !D->hasAttr<SYCLExternalAttr>())
----------------
YuriPlyakhin wrote:

thanks, I was thinking about it. I mark this comment as unresolved. I will 
resolve it by defining `__CLANG_RDC__`

https://github.com/llvm/llvm-project/pull/215437
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to