[PATCH] D19932: [OpenCL] Add to_{global|local|private} builtin functions.
Xiuli PAN via cfe-commits
cfe-commits at lists.llvm.org
Tue May 10 19:02:44 PDT 2016
pxli168 added inline comments.
================
Comment at: test/SemaOpenCL/to_addr_builtin.cl:25
@@ +24,3 @@
+ glob = to_global(con);
+#if __OPENCL_C_VERSION__ < CL_VERSION_2_0
+ // expected-error at -2{{'to_global' needs OpenCL version 2.0 or above}}
----------------
yaxunl wrote:
> pxli168 wrote:
> > But in Spec OpenCL V2.0 s6.13.9 the description for to_global is:
> >
> > > Returns a pointer that points to a region in the global address space if to_global can cast ptr to the global address space. Otherwise it returns NULL.
> >
> I think this is only for valid call expression. For constant pointer, it is an invalid call expression due to s6.5.5, so an error of invalid argument should be emitted.
>
> If we allow passing constant pointer to this function, we violates s6.5.5.
>A pointer that points to the constant address space cannot be cast or implicitly converted to the generic address space.
So if we can not cast, we maybe should return NULL?
@Anastasia What do you think about this?
http://reviews.llvm.org/D19932
More information about the cfe-commits
mailing list