[PATCH] D26794: [OpenCL] Blocks are allowed to capture arrays in OpenCL 2.0 and higher.
Anastasia Stulova via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Apr 10 11:53:34 PDT 2017
Anastasia added inline comments.
================
Comment at: lib/Sema/SemaExpr.cpp:13645
// Blocks are not allowed to capture arrays.
+ if (!S.getLangOpts().OpenCL && CaptureType->isArrayType()) {
----------------
I think the comment should be updated.
================
Comment at: test/SemaOpenCL/blocks_with_array.cl:9
+ block_t b = ^() {
+// CHECK: %{{.*}} = getelementptr inbounds [3 x i32], [3 x i32] addrspace(4)* %{{.*}}, i64 0, i64 0
+ return a[0];
----------------
Does this test anything different from the function `foo` below?
================
Comment at: test/SemaOpenCL/blocks_with_array.cl:21
+ block_t bl1 = ^(){return s.arr[1];};
+// CHECK: define internal spir_func i32 @__foo_block_invoke(i8 addrspace(4)* %.block_descriptor)
+// CHECK: %{{.*}} = getelementptr inbounds %struct.v, %struct.v addrspace(4)* %{{.*}}, i32 0, i32 0
----------------
Can we check there is a memcpy here?
================
Comment at: test/SemaOpenCL/blocks_with_array.cl:27
+ block_t bl2 = ^(){return arr[1];};
+// CHECK: define internal spir_func i32 @__foo_block_invoke_2(i8 addrspace(4)* %.block_descriptor)
+// CHECK: %{{.*}} = getelementptr inbounds [2 x i32], [2 x i32] addrspace(4)* %{{.*}}, i64 0, i64 1
----------------
Can we CHECK-NOT memcpy?
================
Comment at: test/SemaOpenCL/blocks_with_array.cl:30
+ // array decayed to pointer while captured
+ s.arr[1] = arr[1] = 877;
+}
----------------
Do we need this line as well?
https://reviews.llvm.org/D26794
More information about the cfe-commits
mailing list