Skip to content

Commit 998f067

Browse files
committed
[region-isolation] Add support for mark_unresolved_move_addr. It is a store.
1 parent f6cda45 commit 998f067

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

lib/SILOptimizer/Mandatory/TransferNonSendable.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2370,6 +2370,7 @@ CONSTANT_TRANSLATION(ExplicitCopyAddrInst, Store)
23702370
CONSTANT_TRANSLATION(StoreInst, Store)
23712371
CONSTANT_TRANSLATION(StoreBorrowInst, Store)
23722372
CONSTANT_TRANSLATION(StoreWeakInst, Store)
2373+
CONSTANT_TRANSLATION(MarkUnresolvedMoveAddrInst, Store)
23732374

23742375
// These instructions are ignored because they cannot affect the region that a
23752376
// value is within or because even though they are technically a use we would
@@ -2429,7 +2430,6 @@ CONSTANT_TRANSLATION(WeakCopyValueInst, Unhandled)
24292430
CONSTANT_TRANSLATION(StrongCopyWeakValueInst, Unhandled)
24302431
CONSTANT_TRANSLATION(StrongCopyUnmanagedValueInst, Unhandled)
24312432
CONSTANT_TRANSLATION(DropDeinitInst, Unhandled)
2432-
CONSTANT_TRANSLATION(MarkUnresolvedMoveAddrInst, Unhandled)
24332433
CONSTANT_TRANSLATION(IsUniqueInst, Unhandled)
24342434
CONSTANT_TRANSLATION(LoadUnownedInst, Unhandled)
24352435
CONSTANT_TRANSLATION(ProjectExistentialBoxInst, Unhandled)

test/Concurrency/transfernonsendable_instruction_matching.sil

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,3 +353,17 @@ bb0:
353353
%9999 = tuple ()
354354
return %9999 : $()
355355
}
356+
357+
sil [ossa] @mark_unresolved_move_addr_test : $@convention(thin) @async (@in NonSendableKlass) -> () {
358+
bb0(%0 : $*NonSendableKlass):
359+
%1 = alloc_stack $NonSendableKlass
360+
mark_unresolved_move_addr %0 to %1 : $*NonSendableKlass
361+
%4 = function_ref @transferIndirect : $@convention(thin) @async <τ_0_0> (@in_guaranteed τ_0_0) -> ()
362+
apply [caller_isolation=nonisolated] [callee_isolation=global_actor] %4<NonSendableKlass>(%1) : $@convention(thin) @async <τ_0_0> (@in_guaranteed τ_0_0) -> ()
363+
// expected-warning @-1 {{call site passes `self` or a non-sendable argument of this function to another thread, potentially yielding a race with the caller}}
364+
destroy_addr %0 : $*NonSendableKlass
365+
destroy_addr %1 : $*NonSendableKlass
366+
dealloc_stack %1 : $*NonSendableKlass
367+
%9999 = tuple ()
368+
return %9999 : $()
369+
}

0 commit comments

Comments
 (0)