r343583 - [OpenCL] Add block argument CodeGen test
Sven van Haastregt via cfe-commits
cfe-commits at lists.llvm.org
Tue Oct 2 06:02:28 PDT 2018
Author: svenvh
Date: Tue Oct 2 06:02:27 2018
New Revision: 343583
URL: http://llvm.org/viewvc/llvm-project?rev=343583&view=rev
Log:
[OpenCL] Add block argument CodeGen test
r326937 ("[OpenCL] Remove block invoke function from emitted block
literal struct", 2018-03-07) broke block argument handling. In
particular the commit was causing a crash during code generation, see
the discussion in https://reviews.llvm.org/D43783 .
The offending commit has just been reverted; add a test to avoid
breaking this again in the future.
Modified:
cfe/trunk/test/CodeGenOpenCL/blocks.cl
Modified: cfe/trunk/test/CodeGenOpenCL/blocks.cl
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenOpenCL/blocks.cl?rev=343583&r1=343582&r2=343583&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenOpenCL/blocks.cl (original)
+++ cfe/trunk/test/CodeGenOpenCL/blocks.cl Tue Oct 2 06:02:27 2018
@@ -78,6 +78,26 @@ void foo(){
// COMMON-NOT: define{{.*}}@__foo_block_invoke_kernel
+// Test that we support block arguments.
+// COMMON-LABEL: define {{.*}} @blockArgFunc
+int blockArgFunc(int (^ bl)(void)) {
+ return bl();
+}
+
+// COMMON-LABEL: define {{.*}} @get21
+// COMMON: define {{.*}} @__get21_block_invoke
+// COMMON: ret i32 21
+int get21() {
+ return blockArgFunc(^{return 21;});
+}
+
+// COMMON-LABEL: define {{.*}} @get42
+// COMMON: define {{.*}} @__get42_block_invoke
+// COMMON: ret i32 42
+int get42() {
+ return blockArgFunc(^{return 42;});
+}
+
// CHECK-DEBUG: !DIDerivedType(tag: DW_TAG_member, name: "__size"
// CHECK-DEBUG: !DIDerivedType(tag: DW_TAG_member, name: "__align"
More information about the cfe-commits
mailing list