This is an archive of the discontinued LLVM Phabricator instance.

[OpenCL] Enabling the usage of CLK_NULL_QUEUE as compare operand.
ClosedPublic

Authored by echuraev on Dec 8 2016, 2:14 AM.

Diff Detail

Event Timeline

echuraev updated this revision to Diff 80733.Dec 8 2016, 2:14 AM
echuraev retitled this revision from to [OpenCL] Enabling the usage of CLK_NULL_QUEUE as compare operand..
echuraev updated this object.
echuraev added a reviewer: Anastasia.
echuraev added subscribers: bader, yaxunl, cfe-commits.
Anastasia added inline comments.Dec 12 2016, 8:41 AM
lib/Sema/SemaExpr.cpp
9624

getLangOpts().OpenCL is redundant because getLangOpts().OpenCLVersion is only set for OpenCL.

I would like us to minimize number of this checks in the future.

test/CodeGenOpenCL/null_queue.cl
8

I think this doesn't handle initialization yet:

queue_t q = 0;

which should also be possible!

9

could we just compare directly to 0 to make it simpler?

10

Could we check for exactly two occurrences of icmp?

echuraev updated this revision to Diff 81372.Dec 14 2016, 6:03 AM
echuraev marked 4 inline comments as done.
Anastasia added inline comments.Dec 15 2016, 10:38 AM
lib/Sema/SemaOverload.cpp
1784

Is this covered with testing? I have a feeling we might need a test with overloading functions here?

test/CodeGenOpenCL/null_queue.cl
13

I think it would make sense to have a negative test checking that all other integer literals are rejected.

14

Could we also add a function with a queue_t parameter and check that 0 is accepted to be passed in?

echuraev updated this revision to Diff 81742.Dec 16 2016, 5:16 AM
echuraev marked 3 inline comments as done.
Anastasia added inline comments.Dec 16 2016, 6:48 AM
test/SemaOpenCL/queue_t_overload.cl
11

could we also add something non-convertible for queue i.e.

foo(1, src3);
echuraev updated this revision to Diff 81917.Dec 18 2016, 10:30 PM
echuraev marked an inline comment as done.
Anastasia accepted this revision.Dec 19 2016, 10:43 AM
Anastasia edited edge metadata.

LGTM! Thanks!

This revision is now accepted and ready to land.Dec 19 2016, 10:43 AM
echuraev closed this revision.Dec 20 2016, 1:25 AM