@@ -1157,6 +1157,13 @@ enum class TranslationSemantics {
1157
1157
// / handle every instruction to ensure we cover the IR.
1158
1158
Asserting,
1159
1159
1160
+ // / An instruction that the checker thinks it can ignore as long as all of its
1161
+ // / operands are Sendable. If we see that such an instruction has a
1162
+ // / non-Sendable parameter, then someone added an instruction to the compiler
1163
+ // / without updating this code correctly. This is most likely driver error and
1164
+ // / should be caught in testing when we assert.
1165
+ AssertingIfNonSendable,
1166
+
1160
1167
// / An instruction that we do not handle yet. Just for now during bring
1161
1168
// / up. Will be removed.
1162
1169
Unhandled,
@@ -1199,6 +1206,9 @@ llvm::raw_ostream &operator<<(llvm::raw_ostream &os,
1199
1206
case TranslationSemantics::Asserting:
1200
1207
os << " asserting" ;
1201
1208
return os;
1209
+ case TranslationSemantics::AssertingIfNonSendable:
1210
+ os << " asserting_if_nonsendable" ;
1211
+ return os;
1202
1212
case TranslationSemantics::Unhandled:
1203
1213
os << " unhandled" ;
1204
1214
return os;
@@ -2104,6 +2114,16 @@ class PartitionOpTranslator {
2104
2114
case TranslationSemantics::Unhandled:
2105
2115
LLVM_DEBUG (llvm::dbgs () << " Unhandled inst: " << *inst);
2106
2116
return ;
2117
+ case TranslationSemantics::AssertingIfNonSendable:
2118
+ // Do not error if all of our operands are sendable.
2119
+ if (llvm::none_of (inst->getOperandValues (), [&](SILValue value) {
2120
+ return ::isNonSendableType (value->getType (), inst->getFunction ());
2121
+ }))
2122
+ return ;
2123
+ llvm::report_fatal_error (
2124
+ " transfer-non-sendable: Found instruction that is not allowed to "
2125
+ " have non-Sendable parameters with such parameters?!" );
2126
+ return ;
2107
2127
}
2108
2128
2109
2129
llvm_unreachable (" Covered switch isn't covered?!" );
@@ -2400,6 +2420,10 @@ CONSTANT_TRANSLATION(CondBranchInst, TerminatorPhi)
2400
2420
CONSTANT_TRANSLATION(CheckedCastBranchInst, TerminatorPhi)
2401
2421
CONSTANT_TRANSLATION(DynamicMethodBranchInst, TerminatorPhi)
2402
2422
2423
+ // Today, await_async_continuation just takes Sendable values
2424
+ // (UnsafeContinuation and UnsafeThrowingContinuation).
2425
+ CONSTANT_TRANSLATION(AwaitAsyncContinuationInst, AssertingIfNonSendable)
2426
+
2403
2427
// ===---
2404
2428
// Existential Box
2405
2429
//
@@ -2441,7 +2465,6 @@ CONSTANT_TRANSLATION(ExtractExecutorInst, Unhandled)
2441
2465
CONSTANT_TRANSLATION(BindMemoryInst, Unhandled)
2442
2466
CONSTANT_TRANSLATION(RebindMemoryInst, Unhandled)
2443
2467
CONSTANT_TRANSLATION(ThrowAddrInst, Unhandled)
2444
- CONSTANT_TRANSLATION(AwaitAsyncContinuationInst, Unhandled)
2445
2468
CONSTANT_TRANSLATION(BeginUnpairedAccessInst, Unhandled)
2446
2469
CONSTANT_TRANSLATION(EndUnpairedAccessInst, Unhandled)
2447
2470
0 commit comments