@@ -5177,10 +5177,12 @@ void irgen::emitYieldOnce2CoroutineEntry(IRGenFunction &IGF,
51775177 IGF.setCoroutineAllocator (allocator);
51785178 auto allocFn = IGF.IGM .getOpaquePtr (getCoroAllocFn (IGF.IGM ));
51795179 auto deallocFn = IGF.IGM .getOpaquePtr (getCoroDeallocFn (IGF.IGM ));
5180+ auto allocFrameFn = IGF.IGM .getOpaquePtr (getCoroAllocFrameFn (IGF.IGM ));
5181+ auto deallocFrameFn = IGF.IGM .getOpaquePtr (getCoroDeallocFrameFn (IGF.IGM ));
51805182 emitRetconCoroutineEntry (
51815183 IGF, fnType, buffer, llvm::Intrinsic::coro_id_retcon_once_dynamic,
51825184 Size (-1 ) /* dynamic-to-IRGen size*/ , IGF.IGM .getCoroStaticFrameAlignment (),
5183- {cfp, allocator}, allocFn, deallocFn, {});
5185+ {cfp, allocator}, allocFn, deallocFn, {allocFrameFn, deallocFrameFn });
51845186}
51855187void irgen::emitYieldOnce2CoroutineEntry (
51865188 IRGenFunction &IGF, LinkEntity coroFunction, CanSILFunctionType fnType,
@@ -5266,17 +5268,19 @@ StackAddress irgen::emitAllocCoroStaticFrame(IRGenFunction &IGF,
52665268 // TODO: Avoid swift_task_alloc (async) and malloc (yield_once) if the
52675269 // suspension doesn't span an apply of an async function or a yield
52685270 // respectively.
5269- auto retval =
5270- IGF.emitDynamicAlloca (IGF.IGM .Int8Ty , size, Alignment (MaximumAlignment),
5271- /* allowTaskAlloc*/ true , " caller-coro-frame" );
5271+ auto retval = IGF.emitDynamicAlloca (
5272+ IGF.IGM .Int8Ty , size, Alignment (MaximumAlignment), AllowsTaskAlloc,
5273+ IsForCalleeCoroutineFrame_t (IGF.isCalleeAllocatedCoroutine ()),
5274+ " callee-coro-frame" );
52725275 IGF.Builder .CreateLifetimeStart (retval.getAddress (),
52735276 Size (-1 ) /* dynamic size*/ );
52745277 return retval;
52755278}
52765279void irgen::emitDeallocCoroStaticFrame (IRGenFunction &IGF, StackAddress frame) {
52775280 IGF.Builder .CreateLifetimeEnd (frame.getAddress (), Size (-1 ) /* dynamic size*/ );
52785281 IGF.emitDeallocateDynamicAlloca (frame, /* allowTaskAlloc*/ true ,
5279- /* useTaskDeallocThrough*/ true );
5282+ /* useTaskDeallocThrough*/ true ,
5283+ /* forCalleeCoroutineFrame*/ true );
52805284}
52815285
52825286llvm::Value *irgen::emitYield (IRGenFunction &IGF,
0 commit comments