[PATCH] Sema: Accept pointers to any address space for builtin functions

Anastasia anastasia.stulova at arm.com
Thu Mar 5 09:43:56 PST 2015


REPOSITORY
  rL LLVM

================
Comment at: lib/Sema/SemaExpr.cpp:4393
@@ +4392,3 @@
+
+        Expr *PtrArg = DefaultFunctionArrayLvalueConversion(Arg).get();
+        QualType PtrTy = PtrArg->getType();
----------------
tstellarAMD wrote:
> Anastasia wrote:
> > Not sure if this cast might create a problem in some OpenCL-GPU architectures, because spec generally disallows conversion between constant and any other address spaces (see OpenCL C v2.0 s6.5.5). 
> > 
> > I feel like a better way to handle this would be to create separate builtins overloads for constant and generic address space in OpenCL v2.0 and for all address spaces in OpenCL <v2.0. But this seems more work to me.
> I'm not sure about the cast issue.  I do see that for memcpy addrspacecast IR instructions are emitted.
> 
> I'm open to adding separate overloads, I just wanted to try a generic solution first.
Could you please look into this. The solution doesn't seem generic to me, because in OpenCL conversions from constant to other address spaces are not allowed. Which means this would most likely be a problem to handle correctly on the later compiler steps. In Clang however, we can avoid this issue by creating different overloads for such builtins and calling directly the right overload instead of having one overload and adding conversions to match it.

http://reviews.llvm.org/D8082

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the cfe-commits mailing list