[clang] [Clang] Emit stub version of OpenCL Kernel (PR #115821)

Aniket Lal via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 25 01:29:54 PST 2024


================
@@ -127,7 +127,10 @@ static const BlockExpr *getBlockExpr(const Expr *E) {
 void CGOpenCLRuntime::recordBlockInfo(const BlockExpr *E,
                                       llvm::Function *InvokeF,
                                       llvm::Value *Block, llvm::Type *BlockTy) {
-  assert(!EnqueuedBlockMap.contains(E) && "Block expression emitted twice");
+
+  // FIXME: Since OpenCL Kernels are emitted twice (kernel version and stub
+  // version), its constituent BlockExpr will also be emitted twice.
+  // assert(!EnqueuedBlockMap.contains(E) && "Block expression emitted twice");
----------------
lalaniket8 wrote:

If Kernel function contains BlockExpr, the BlockExpr *E is emitted twice (once during emission of kernel function and other while emission of its device variant). This leads to a failing assert which finds BlockExpr pointer E stored in EnqueuedBlockMap. 

https://github.com/llvm/llvm-project/pull/115821


More information about the cfe-commits mailing list