Skip to content

Commit 683e94f

Browse files
authored
Merge pull request #72368 from gottesmm/pr-14b84426e480f5b5049c09df01c9445308dd19c5
[region-isolation] Change semantics of function_extract_isolation from AssertingIfNonSendable -> Require.
2 parents d00866a + e2ddb08 commit 683e94f

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

lib/SILOptimizer/Analysis/RegionAnalysis.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2638,7 +2638,7 @@ CONSTANT_TRANSLATION(DynamicMethodBranchInst, TerminatorPhi)
26382638
CONSTANT_TRANSLATION(AwaitAsyncContinuationInst, AssertingIfNonSendable)
26392639
CONSTANT_TRANSLATION(GetAsyncContinuationInst, AssertingIfNonSendable)
26402640
CONSTANT_TRANSLATION(ExtractExecutorInst, AssertingIfNonSendable)
2641-
CONSTANT_TRANSLATION(FunctionExtractIsolationInst, AssertingIfNonSendable)
2641+
CONSTANT_TRANSLATION(FunctionExtractIsolationInst, Require)
26422642

26432643
//===---
26442644
// Existential Box

test/Concurrency/transfernonsendable_instruction_matching.sil

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ sil_stage raw
1717

1818
import Swift
1919
import Builtin
20+
import _Concurrency
2021

2122
class NonSendableKlass {}
2223

@@ -1551,6 +1552,22 @@ bb0(%index : $Builtin.Word):
15511552
return %9999 : $()
15521553
}
15531554

1555+
sil @function_extract_isolation_test_closure : $@convention(thin) (@guaranteed Optional<any Actor>, Int) -> ()
1556+
1557+
// This used to crash when function_extract_isolation was AssertingIfNonSendable.
1558+
sil [ossa] @function_extract_isolation_test : $@async @convention(thin) (@owned Optional<any Actor>, Int) -> () {
1559+
bb0(%actor : @owned $Optional<any Actor>, %int : $Int):
1560+
%f = function_ref @function_extract_isolation_test_closure : $@convention(thin) (@guaranteed Optional<any Actor>, Int) -> ()
1561+
%closure = partial_apply [isolated_any] [callee_guaranteed] %f(%actor, %int) : $@convention(thin) (@guaranteed Optional<any Actor>, Int) -> ()
1562+
%closure_b = begin_borrow %closure : $@callee_guaranteed @isolated(any) () -> ()
1563+
%outputActor = function_extract_isolation %closure_b : $@callee_guaranteed @isolated(any) () -> ()
1564+
end_borrow %closure_b : $@callee_guaranteed @isolated(any) () -> ()
1565+
destroy_value %closure : $@callee_guaranteed @isolated(any) () -> ()
1566+
1567+
%9999 = tuple ()
1568+
return %9999 : $()
1569+
}
1570+
15541571
sil [ossa] @begin_unpaired_access_test : $@async @convention(thin) () -> () {
15551572
bb0:
15561573
%constructFn = function_ref @constructNonSendableKlass : $@convention(thin) () -> @owned NonSendableKlass

0 commit comments

Comments
 (0)