@@ -130,10 +130,11 @@ void CGOpenCLRuntime::recordBlockInfo(const BlockExpr *E,
130
130
assert (!EnqueuedBlockMap.contains (E) && " Block expression emitted twice" );
131
131
assert (isa<llvm::Function>(InvokeF) && " Invalid invoke function" );
132
132
assert (Block->getType ()->isPointerTy () && " Invalid block literal type" );
133
- EnqueuedBlockMap[E].InvokeFunc = InvokeF;
134
- EnqueuedBlockMap[E].BlockArg = Block;
135
- EnqueuedBlockMap[E].BlockTy = BlockTy;
136
- EnqueuedBlockMap[E].KernelHandle = nullptr ;
133
+ EnqueuedBlockInfo &BlockInfo = EnqueuedBlockMap[E];
134
+ BlockInfo.InvokeFunc = InvokeF;
135
+ BlockInfo.BlockArg = Block;
136
+ BlockInfo.BlockTy = BlockTy;
137
+ BlockInfo.KernelHandle = nullptr ;
137
138
}
138
139
139
140
llvm::Function *CGOpenCLRuntime::getInvokeFunction (const Expr *E) {
@@ -148,17 +149,19 @@ CGOpenCLRuntime::emitOpenCLEnqueuedBlock(CodeGenFunction &CGF, const Expr *E) {
148
149
// to get the block literal.
149
150
const BlockExpr *Block = getBlockExpr (E);
150
151
151
- assert (EnqueuedBlockMap.contains (Block) && " Block expression not emitted" );
152
+ auto It = EnqueuedBlockMap.find (Block);
153
+ assert (It != EnqueuedBlockMap.end () && " Block expression not emitted" );
154
+ EnqueuedBlockInfo &BlockInfo = It->second ;
152
155
153
156
// Do not emit the block wrapper again if it has been emitted.
154
- if (EnqueuedBlockMap[Block] .KernelHandle ) {
155
- return EnqueuedBlockMap[Block] ;
157
+ if (BlockInfo .KernelHandle ) {
158
+ return BlockInfo ;
156
159
}
157
160
158
161
auto *F = CGF.getTargetHooks ().createEnqueuedBlockKernel (
159
- CGF, EnqueuedBlockMap[Block] .InvokeFunc , EnqueuedBlockMap[Block] .BlockTy );
162
+ CGF, BlockInfo .InvokeFunc , BlockInfo .BlockTy );
160
163
161
164
// The common part of the post-processing of the kernel goes here.
162
- EnqueuedBlockMap[Block] .KernelHandle = F;
163
- return EnqueuedBlockMap[Block] ;
165
+ BlockInfo .KernelHandle = F;
166
+ return BlockInfo ;
164
167
}
0 commit comments