@@ -87,9 +87,7 @@ static std::optional<Size> getCoroutineContextSize(IRGenModule &IGM,
8787 case SILCoroutineKind::None:
8888 llvm_unreachable (" expand a coroutine" );
8989 case SILCoroutineKind::YieldOnce2:
90- if (!IGM.IRGen .Opts .EmitYieldOnce2AsYieldOnce )
91- return std::nullopt ;
92- LLVM_FALLTHROUGH;
90+ return std::nullopt ;
9391 case SILCoroutineKind::YieldOnce:
9492 return getYieldOnceCoroutineBufferSize (IGM);
9593 case SILCoroutineKind::YieldMany:
@@ -387,7 +385,7 @@ irgen::expandCallingConv(IRGenModule &IGM,
387385 case SILFunctionTypeRepresentation::KeyPathAccessorSetter:
388386 case SILFunctionTypeRepresentation::KeyPathAccessorEquals:
389387 case SILFunctionTypeRepresentation::KeyPathAccessorHash:
390- if (isCalleeAllocatedCoro && !IGM. getOptions (). EmitYieldOnce2AsYieldOnce )
388+ if (isCalleeAllocatedCoro)
391389 return IGM.SwiftCoroCC ;
392390 if (isAsync)
393391 return IGM.SwiftAsyncCC ;
@@ -578,7 +576,7 @@ namespace {
578576
579577 // / Expand the components of the continuation entrypoint of the
580578 // / function type.
581- void expandCoroutineContinuationType (bool emitYieldOnce2AsYieldOnce );
579+ void expandCoroutineContinuationType ();
582580
583581 // Expand the components for the async continuation entrypoint of the
584582 // function type (the function to be called on returning).
@@ -646,7 +644,7 @@ namespace {
646644 void expandExternalSignatureTypes ();
647645
648646 void expandCoroutineResult (bool forContinuation);
649- void expandCoroutineContinuationParameters (bool emitYieldOnce2AsYieldOnce );
647+ void expandCoroutineContinuationParameters ();
650648
651649 void addIndirectThrowingResult ();
652650 llvm::Type *getErrorRegisterType ();
@@ -886,12 +884,11 @@ void SignatureExpansion::expandCoroutineResult(bool forContinuation) {
886884 : llvm::StructType::get (IGM.getLLVMContext (), components);
887885}
888886
889- void SignatureExpansion::expandCoroutineContinuationParameters (
890- bool emitYieldOnce2AsYieldOnce) {
887+ void SignatureExpansion::expandCoroutineContinuationParameters () {
891888 // The coroutine context.
892889 addCoroutineContextParameter ();
893890
894- if (FnType->isCalleeAllocatedCoroutine () && !emitYieldOnce2AsYieldOnce ) {
891+ if (FnType->isCalleeAllocatedCoroutine ()) {
895892 // Whether this is an unwind resumption.
896893 ParamIRTypes.push_back (IGM.CoroAllocatorPtrTy );
897894 } else {
@@ -1950,12 +1947,10 @@ void SignatureExpansion::expandParameters(
19501947 case SILCoroutineKind::None:
19511948 break ;
19521949 case SILCoroutineKind::YieldOnce2:
1953- if (!IGM.IRGen .Opts .EmitYieldOnce2AsYieldOnce ) {
1954- addCoroutineContextParameter ();
1955- addCoroutineAllocatorParameter ();
1956- break ;
1957- }
1958- LLVM_FALLTHROUGH;
1950+ addCoroutineContextParameter ();
1951+ addCoroutineAllocatorParameter ();
1952+
1953+ break ;
19591954 case SILCoroutineKind::YieldOnce:
19601955 case SILCoroutineKind::YieldMany:
19611956 addCoroutineContextParameter ();
@@ -2121,10 +2116,9 @@ void SignatureExpansion::expandFunctionType(
21212116 llvm_unreachable (" bad abstract calling convention" );
21222117}
21232118
2124- void SignatureExpansion::expandCoroutineContinuationType (
2125- bool emitYieldOnce2AsYieldOnce) {
2119+ void SignatureExpansion::expandCoroutineContinuationType () {
21262120 expandCoroutineResult (/* for continuation*/ true );
2127- expandCoroutineContinuationParameters (emitYieldOnce2AsYieldOnce );
2121+ expandCoroutineContinuationParameters ();
21282122}
21292123
21302124llvm::Type *SignatureExpansion::getErrorRegisterType () {
@@ -2457,8 +2451,7 @@ Signature Signature::forCoroutineContinuation(IRGenModule &IGM,
24572451 CanSILFunctionType fnType) {
24582452 assert (fnType->isCoroutine ());
24592453 SignatureExpansion expansion (IGM, fnType, FunctionPointerKind (fnType));
2460- expansion.expandCoroutineContinuationType (
2461- IGM.IRGen .Opts .EmitYieldOnce2AsYieldOnce );
2454+ expansion.expandCoroutineContinuationType ();
24622455 return expansion.getSignature ();
24632456}
24642457
@@ -2768,15 +2761,15 @@ class SyncCallEmission final : public CallEmission {
27682761 assert (!coroStaticFrame.isValid ());
27692762 assert (!coroAllocator);
27702763
2771- if (IsCalleeAllocatedCoroutine &&
2772- !IGF.IGM .IRGen .Opts .EmitYieldOnce2AsYieldOnce ) {
2764+ if (IsCalleeAllocatedCoroutine) {
27732765 llvm::Value *bufferSize32;
27742766 std::tie (calleeFunction, bufferSize32) =
27752767 getCoroFunctionAndSize (IGF, CurCallee.getFunctionPointer ());
27762768 auto *bufferSize = IGF.Builder .CreateZExt (bufferSize32, IGF.IGM .SizeTy );
27772769 coroStaticFrame = emitAllocYieldOnce2CoroutineFrame (IGF, bufferSize);
2778- // TODO: Optimize allocator kind (e.g. async callers only need to use the
2779- // TaskAllocator if the coroutine is suspended across an await).
2770+ // TODO: CoroutineAccessors: Optimize allocator kind (e.g. async callers
2771+ // only need to use the TaskAllocator if the
2772+ // coroutine is suspended across an await).
27802773 coroAllocator = emitYieldOnce2CoroutineAllocator (
27812774 IGF, IGF.getDefaultCoroutineAllocatorKind ());
27822775 }
@@ -2878,11 +2871,8 @@ class SyncCallEmission final : public CallEmission {
28782871 switch (origCalleeType->getCoroutineKind ()) {
28792872 case SILCoroutineKind::YieldOnce2:
28802873 // Pass along the coroutine buffer and allocator.
2881- if (!IGF.IGM .IRGen .Opts .EmitYieldOnce2AsYieldOnce ) {
2882- original.transferInto (adjusted, 2 );
2883- break ;
2884- }
2885- LLVM_FALLTHROUGH;
2874+ original.transferInto (adjusted, 2 );
2875+ break ;
28862876 case SILCoroutineKind::YieldOnce:
28872877 case SILCoroutineKind::YieldMany:
28882878 // Pass along the coroutine buffer.
@@ -4974,10 +4964,8 @@ irgen::getCoroutineResumeFunctionPointerAuth(IRGenModule &IGM,
49744964 return { IGM.getOptions ().PointerAuth .YieldManyResumeFunctions ,
49754965 PointerAuthEntity::forYieldTypes (fnType) };
49764966 case SILCoroutineKind::YieldOnce2:
4977- if (!IGM.IRGen .Opts .EmitYieldOnce2AsYieldOnce )
4978- return {IGM.getOptions ().PointerAuth .YieldOnce2ResumeFunctions ,
4979- PointerAuthEntity::forYieldTypes (fnType)};
4980- LLVM_FALLTHROUGH;
4967+ return {IGM.getOptions ().PointerAuth .YieldOnce2ResumeFunctions ,
4968+ PointerAuthEntity::forYieldTypes (fnType)};
49814969 case SILCoroutineKind::YieldOnce:
49824970 return { IGM.getOptions ().PointerAuth .YieldOnceResumeFunctions ,
49834971 PointerAuthEntity::forYieldTypes (fnType) };
@@ -5233,10 +5221,6 @@ void irgen::emitDeallocYieldManyCoroutineBuffer(IRGenFunction &IGF,
52335221
52345222void irgen::emitDeallocYieldOnce2CoroutineFrame (IRGenFunction &IGF,
52355223 StackAddress frame) {
5236- if (IGF.IGM .IRGen .Opts .EmitYieldOnce2AsYieldOnce ) {
5237- assert (!frame.isValid ());
5238- return ;
5239- }
52405224 assert (frame.isValid ());
52415225 emitDeallocCoroStaticFrame (IGF, frame);
52425226}
@@ -5352,8 +5336,7 @@ llvm::Value *irgen::emitYield(IRGenFunction &IGF,
53525336
53535337 // Perform the yield.
53545338 llvm::Value *isUnwind = nullptr ;
5355- if (coroutineType->isCalleeAllocatedCoroutine () &&
5356- !IGF.IGM .IRGen .Opts .EmitYieldOnce2AsYieldOnce ) {
5339+ if (coroutineType->isCalleeAllocatedCoroutine ()) {
53575340 IGF.Builder .CreateIntrinsicCall (llvm::Intrinsic::coro_suspend_retcon,
53585341 {IGF.IGM .CoroAllocatorPtrTy }, yieldArgs);
53595342 isUnwind = llvm::ConstantInt::get (IGF.IGM .Int1Ty , 0 );
0 commit comments