This is an archive of the discontinued LLVM Phabricator instance.

[OpenCL] Diagnose program scope pointers
AbandonedPublic

Authored by Anastasia on Feb 17 2016, 11:45 AM.

Details

Summary

Programs scope pointers should point to objects in constant AS or for OpenCL 2.0 in global AS.

Diff Detail

Event Timeline

Anastasia updated this revision to Diff 48224.Feb 17 2016, 11:45 AM
Anastasia retitled this revision from to [OpenCL] Diagnose program scope pointers.
Anastasia updated this object.
Anastasia added a subscriber: cfe-commits.
mgrang added a subscriber: mgrang.Feb 17 2016, 11:55 AM
mgrang added inline comments.
lib/Sema/SemaDecl.cpp
6605

Check alignment of comments.

6625

Can you combine the assignment to PT inside the if condition? Like:

if (foo = something())

6629

Any reason why this cannot be a while loop instead of a do..while loop?

yaxunl edited edge metadata.Feb 17 2016, 12:24 PM

I am not sure about the restriction that program scope pointer must point to global or constant addr space. Can you provide reference to the OpenCL 2.0 spec?

https://www.khronos.org/registry/cl/specs/opencl-2.0-openclc.pdf

On page 36 there are examples for program-scope pointers:

int *foo; // OK. foo is allocated in global address space.

// pointer to foo in generic address space

int * global ptr; // OK.

It seems at least program-scope pointers pointing to generic addr space is also allowed.

Anastasia abandoned this revision.Jul 12 2016, 10:12 AM

After clarifying with Khronos, it doesn't seem like this is needed indeed!