Skip to content

Commit a5fe75e

Browse files
Merge pull request #64549 from nate-chandler/hop_to_executor-may-synchronize
[SILOptimizer] hop_to_executor may synchronize.
2 parents d433e48 + a2c81df commit a5fe75e

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

lib/SIL/Utils/MemAccessUtils.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,8 @@ bool swift::mayLoadWeakOrUnowned(SILInstruction *instruction) {
427427
bool swift::maySynchronizeNotConsideringSideEffects(SILInstruction *instruction) {
428428
return FullApplySite::isa(instruction)
429429
|| isa<EndApplyInst>(instruction)
430-
|| isa<AbortApplyInst>(instruction);
430+
|| isa<AbortApplyInst>(instruction)
431+
|| isa<HopToExecutorInst>(instruction);
431432
}
432433

433434
bool swift::mayBeDeinitBarrierNotConsideringSideEffects(SILInstruction *instruction) {

test/SILOptimizer/deinit_barrier.sil

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,3 +85,21 @@ entry:
8585
return %retval : $()
8686
}
8787

88+
actor A {}
89+
90+
sil @getA : $() -> (@owned A)
91+
sil @borrowA : $@yield_once @convention(thin) () -> @yields @guaranteed A
92+
93+
// CHECK-LABEL: begin running test 1 of 1 on test_hop_to_executor: is-deinit-barrier
94+
// CHECK: hop_to_executor
95+
// CHECK: true
96+
// CHECK-LABEL: end running test 1 of 1 on test_hop_to_executor: is-deinit-barrier
97+
sil [ossa] @test_hop_to_executor : $@convention(thin) () -> () {
98+
%borrowA = function_ref @borrowA : $@yield_once @convention(thin) () -> @yields @guaranteed A
99+
(%a, %token) = begin_apply %borrowA() : $@yield_once @convention(thin) () -> @yields @guaranteed A
100+
test_specification "is-deinit-barrier @instruction"
101+
hop_to_executor %a : $A
102+
end_apply %token
103+
%retval = tuple ()
104+
return %retval : $()
105+
}

0 commit comments

Comments
 (0)