[PATCH] D27569: [OpenCL] Enabling the usage of CLK_NULL_QUEUE as compare operand.

Anastasia Stulova via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 12 08:41:39 PST 2016


Anastasia added inline comments.


================
Comment at: lib/Sema/SemaExpr.cpp:9624
 
+  if (getLangOpts().OpenCL && getLangOpts().OpenCLVersion >= 200) {
+    if (LHSIsNull && RHSType->isQueueT()) {
----------------
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.


================
Comment at: test/CodeGenOpenCL/null_queue.cl:7
+bool f() {
+  return CLK_NULL_QUEUE == get_default_queue() &&
+         get_default_queue() == CLK_NULL_QUEUE;
----------------
I think this doesn't handle initialization yet:
  queue_t q = 0;
which should also be possible! 


================
Comment at: test/CodeGenOpenCL/null_queue.cl:8
+  return CLK_NULL_QUEUE == get_default_queue() &&
+         get_default_queue() == CLK_NULL_QUEUE;
+  // CHECK: icmp eq %opencl.queue_t* null, %{{.*}}
----------------
could we just compare directly to 0 to make it simpler?


================
Comment at: test/CodeGenOpenCL/null_queue.cl:9
+         get_default_queue() == CLK_NULL_QUEUE;
+  // CHECK: icmp eq %opencl.queue_t* null, %{{.*}}
+}
----------------
Could we check for exactly two occurrences of icmp?


https://reviews.llvm.org/D27569





More information about the cfe-commits mailing list