================
@@ -12952,8 +12956,11 @@ bool ASTContext::DeclMustBeEmitted(const Decl *D) {
if (LangOpts.SYCLIsDevice && FD->hasAttr<SYCLKernelEntryPointAttr>())
return true;
- // FIXME: Functions declared with SYCL_EXTERNAL are required during
- // device compilation.
+ // Function definitions with the sycl_external attribute are required
+ // during device compilation regardless of whether they are reachable from
+ // a SYCL kernel.
+ if (LangOpts.SYCLIsDevice && FD->hasAttr<SYCLExternalAttr>())
+ return true;
----------------
tahonermann wrote:
@bader, these attributes are enabled during both host and device compilation.
The semantic effects here are specific to device compilation so we need to
check for `SYCLIsDevice`.
I'm not in favor of your first suggestion because I think it is useful to keep
the comments colocated with their associated checks. The second suggestion is
ok, but I don't see it as an improvement since it implies grouping where there
is no need to group and might mislead future contributors to think they should
place SYCL related checks there when that might not be correct. The optimizer
will effectively transform the current code into your suggestion anyway.
https://github.com/llvm/llvm-project/pull/140282
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits