You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[region-isolation] Add support for unchecked_trivial_bit_cast
NOTE: This required me to stop using swift::getUnderlyingObject from
getUnderlyingTrackedObject since when it stripsCasts it looks through
unchecked_trivial_bit_cast... but we only want to do that if both the operand
and result of the instruction are non-Sendable. To fix this I inlined
getUnderlyingObject's impl and removed that part of stripCasts.
// expected-warning @-1 {{passing argument of non-sendable type 'Builtin.RawPointer' from nonisolated context to global actor '<null>'-isolated context at this call site could yield a race with accesses later in this function}}
594
+
595
+
fix_lifetime %value : $NonSendableKlass
596
+
// expected-note @-1 {{access here could race}}
597
+
598
+
destroy_value %value : $NonSendableKlass
599
+
%9999 = tuple ()
600
+
return %9999 : $()
601
+
}
602
+
603
+
sil [ossa] @unchecked_trivial_bitcast_test_sendable_to_nonsendable : $@convention(thin) @async () -> () {
// expected-warning @-1 {{passing argument of non-sendable type 'Builtin.RawPointer' from nonisolated context to global actor '<null>'-isolated context at this call site could yield a race with accesses later in this function}}
// expected-warning @-1 {{passing argument of non-sendable type 'Builtin.RawPointer' from nonisolated context to global actor '<null>'-isolated context at this call site could yield a race with accesses later in this function}}
618
+
// expected-note @-2 {{access here could race}}
619
+
620
+
fix_lifetime %rawPointer : $Builtin.RawPointer
621
+
// expected-note @-1 {{access here could race}}
622
+
623
+
destroy_value %value : $SendableKlass
624
+
%9999 = tuple ()
625
+
return %9999 : $()
626
+
}
627
+
628
+
sil [ossa] @unchecked_trivial_bitcast_test_nonsendable_to_sendable : $@convention(thin) @async () -> () {
// expected-warning @-1 {{passing argument of non-sendable type 'NonSendableKlass' from nonisolated context to global actor '<null>'-isolated context at this call site could yield a race with accesses later in this function}}
636
+
637
+
%word = unchecked_trivial_bit_cast %value : $NonSendableKlass to $Builtin.Word
638
+
// expected-note @-1 {{access here could race}}
639
+
640
+
destroy_value %value : $NonSendableKlass
641
+
%9999 = tuple ()
642
+
return %9999 : $()
643
+
}
644
+
645
+
sil [ossa] @unchecked_trivial_bitcast_test_sendable_to_sendable : $@convention(thin) @async () -> () {
0 commit comments