Skip to content

Commit 995bc0e

Browse files
authored
Merge pull request swiftlang#78951 from compnerd/through-the-cracks
IRGen: correct some invalid code
2 parents 0587075 + bac1554 commit 995bc0e

File tree

1 file changed

+8
-17
lines changed

1 file changed

+8
-17
lines changed

lib/IRGen/GenCall.cpp

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,10 @@ static Size getCoroutineContextSize(IRGenModule &IGM,
8383
case SILCoroutineKind::None:
8484
llvm_unreachable("expand a coroutine");
8585
case SILCoroutineKind::YieldOnce2:
86-
if (IGM.IRGen.Opts.EmitYieldOnce2AsYieldOnce) {
87-
LLVM_FALLTHROUGH;
88-
} else {
86+
if (!IGM.IRGen.Opts.EmitYieldOnce2AsYieldOnce)
8987
llvm::report_fatal_error(
9088
"callee allocated coroutines do not have fixed-size buffers");
91-
}
89+
LLVM_FALLTHROUGH;
9290
case SILCoroutineKind::YieldOnce:
9391
return getYieldOnceCoroutineBufferSize(IGM);
9492
case SILCoroutineKind::YieldMany:
@@ -1912,11 +1910,9 @@ void SignatureExpansion::expandParameters(
19121910
case SILCoroutineKind::None:
19131911
break;
19141912
case SILCoroutineKind::YieldOnce2:
1915-
if (IGM.IRGen.Opts.EmitYieldOnce2AsYieldOnce) {
1916-
LLVM_FALLTHROUGH;
1917-
} else {
1913+
if (!IGM.IRGen.Opts.EmitYieldOnce2AsYieldOnce)
19181914
break;
1919-
}
1915+
LLVM_FALLTHROUGH;
19201916

19211917
case SILCoroutineKind::YieldOnce:
19221918
case SILCoroutineKind::YieldMany:
@@ -2720,12 +2716,9 @@ class SyncCallEmission final : public CallEmission {
27202716
// Pass along the coroutine buffer.
27212717
switch (origCalleeType->getCoroutineKind()) {
27222718
case SILCoroutineKind::YieldOnce2:
2723-
if (IGF.IGM.IRGen.Opts.EmitYieldOnce2AsYieldOnce) {
2724-
LLVM_FALLTHROUGH;
2725-
} else {
2719+
if (!IGF.IGM.IRGen.Opts.EmitYieldOnce2AsYieldOnce)
27262720
llvm::report_fatal_error("unimplemented");
2727-
break;
2728-
}
2721+
LLVM_FALLTHROUGH;
27292722
case SILCoroutineKind::YieldOnce:
27302723
case SILCoroutineKind::YieldMany:
27312724
original.transferInto(adjusted, 1);
@@ -4810,12 +4803,10 @@ irgen::getCoroutineResumeFunctionPointerAuth(IRGenModule &IGM,
48104803
return { IGM.getOptions().PointerAuth.YieldManyResumeFunctions,
48114804
PointerAuthEntity::forYieldTypes(fnType) };
48124805
case SILCoroutineKind::YieldOnce2:
4813-
if (IGM.IRGen.Opts.EmitYieldOnce2AsYieldOnce) {
4814-
LLVM_FALLTHROUGH;
4815-
} else {
4806+
if (!IGM.IRGen.Opts.EmitYieldOnce2AsYieldOnce)
48164807
return {IGM.getOptions().PointerAuth.YieldOnce2ResumeFunctions,
48174808
PointerAuthEntity::forYieldTypes(fnType)};
4818-
}
4809+
LLVM_FALLTHROUGH;
48194810
case SILCoroutineKind::YieldOnce:
48204811
return { IGM.getOptions().PointerAuth.YieldOnceResumeFunctions,
48214812
PointerAuthEntity::forYieldTypes(fnType) };

0 commit comments

Comments
 (0)