From a12a2f03466cdc1d639f3d10a94fc22e0609c67c Mon Sep 17 00:00:00 2001 From: Anuj Mittal Date: Tue, 26 Mar 2019 14:08:36 +0800 Subject: clang: build Intel common-clang and spirv Common clang is a thin wrapper library around clang. Common clang has OpenCL-oriented API and is capable to compile OpenCL C kernels to SPIR-V modules. This adds a bbappend to clang recipe from meta-clang to build the necessary components and moves it to dynamic layers so it's built only when clang-layer is included. Signed-off-by: Anuj Mittal --- .../0003-OpenCL-Fix-assertion-due-to-blocks.patch | 61 ++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 dynamic-layers/clang-layer/recipes-devtools/clang/files/0003-OpenCL-Fix-assertion-due-to-blocks.patch (limited to 'dynamic-layers/clang-layer/recipes-devtools/clang/files/0003-OpenCL-Fix-assertion-due-to-blocks.patch') diff --git a/dynamic-layers/clang-layer/recipes-devtools/clang/files/0003-OpenCL-Fix-assertion-due-to-blocks.patch b/dynamic-layers/clang-layer/recipes-devtools/clang/files/0003-OpenCL-Fix-assertion-due-to-blocks.patch new file mode 100644 index 00000000..510c7c6e --- /dev/null +++ b/dynamic-layers/clang-layer/recipes-devtools/clang/files/0003-OpenCL-Fix-assertion-due-to-blocks.patch @@ -0,0 +1,61 @@ +From 29e2813a2ab7d5569860bb07892dfef7b5374d96 Mon Sep 17 00:00:00 2001 +From: Yaxun Liu +Date: Tue, 26 Feb 2019 16:20:41 +0000 +Subject: [PATCH] [OpenCL] Fix assertion due to blocks + +A recent change caused assertion in CodeGenFunction::EmitBlockCallExpr when a block is called. + +There is code + + Func = CGM.getOpenCLRuntime().getInvokeFunction(E->getCallee()); +getCalleeDecl calls Expr::getReferencedDeclOfCallee, which does not handle +BlockExpr and returns nullptr, which causes isa to assert. + +This patch fixes that. + +Differential Revision: https://reviews.llvm.org/D58658 + + +git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@354893 91177308-0d34-0410-b5e6-96231b3b80d8 + +Upstream-Status: Backport +[https://github.com/llvm-mirror/clang/commit/29e2813a2ab7d5569860bb07892dfef7b5374d96] +Signed-off-by: Anuj Mittal +--- + lib/AST/Expr.cpp | 2 ++ + test/CodeGenOpenCL/blocks.cl | 6 ++++++ + 2 files changed, 8 insertions(+) + +diff --git a/lib/AST/Expr.cpp b/lib/AST/Expr.cpp +index aef1eab..85690c7 100644 +--- a/lib/AST/Expr.cpp ++++ b/lib/AST/Expr.cpp +@@ -1358,6 +1358,8 @@ Decl *Expr::getReferencedDeclOfCallee() { + return DRE->getDecl(); + if (MemberExpr *ME = dyn_cast(CEE)) + return ME->getMemberDecl(); ++ if (auto *BE = dyn_cast(CEE)) ++ return BE->getBlockDecl(); + + return nullptr; + } +diff --git a/test/CodeGenOpenCL/blocks.cl b/test/CodeGenOpenCL/blocks.cl +index ab5a2c6..c3e2685 100644 +--- a/test/CodeGenOpenCL/blocks.cl ++++ b/test/CodeGenOpenCL/blocks.cl +@@ -90,6 +90,12 @@ int get42() { + return blockArgFunc(^{return 42;}); + } + ++// COMMON-LABEL: define {{.*}}@call_block ++// call {{.*}}@__call_block_block_invoke ++int call_block() { ++ return ^int(int num) { return num; } (11); ++} ++ + // CHECK-DEBUG: !DIDerivedType(tag: DW_TAG_member, name: "__size" + // CHECK-DEBUG: !DIDerivedType(tag: DW_TAG_member, name: "__align" + +-- +1.8.3.1 + -- cgit v1.2.3-54-g00ecf