================ @@ -1085,8 +1085,10 @@ llvm::Value *CodeGenFunction::EmitBlockLiteral(const CGBlockInfo &blockInfo) { blockAddr.getPointer(), ConvertType(blockInfo.getBlockExpr()->getType())); if (IsOpenCL) { - CGM.getOpenCLRuntime().recordBlockInfo(blockInfo.BlockExpression, InvokeFn, - result, blockInfo.StructureType); + CGM.getOpenCLRuntime().recordBlockInfo( + blockInfo.BlockExpression, InvokeFn, result, blockInfo.StructureType, + CurGD && CurGD.isDeclOpenCLKernel() && + (CurGD.getKernelReferenceKind() == KernelReferenceKind::Kernel)); ---------------- rjmccall wrote:
This is trying to protect against double-registering the block, right? But that's only necessary if you're double-emitting the kernel body, which you really shouldn't be doing — there are a lot of other places that assume that function bodies are only emitted once, like `static` locals. Probably the kernel should be emitted by calling the stub or vice-versa? https://github.com/llvm/llvm-project/pull/115821 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits