================
@@ -6905,6 +6905,37 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl 
GD, unsigned BuiltinID,
     auto Str = CGM.GetAddrOfConstantCString(Name, "");
     return RValue::get(Str.getPointer());
   }
+  case Builtin::BI__builtin_sycl_dynamic_local_memory: {
+    llvm::Type *RetTy = ConvertType(E->getType());
+    // Dynamic local memory only exists on the device; host code never reaches
+    // a kernel's reification, so return a null pointer.
+    if (!getLangOpts().SYCLIsDevice)
+      return RValue::get(
+          llvm::ConstantPointerNull::get(cast<llvm::PointerType>(RetTy)));
----------------
tahonermann wrote:

I mentioned elsewhere as well, but please diagnose the use in host code if 
possible. That might turn out to be problematic in some cases. For example, a 
non-inline function defined with `SYCL_EXTERNAL` is emitted for both host and 
device compilation. But that might also be a good thing since, I think, this 
builtin function can't be reliable used from a `SYCL_EXTERNAL` function unless 
the kernel that calls it is also defined in the same translation unit.

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

Reply via email to