Skip to content

Commit 488581f

Browse files
authored
Merge pull request #76715 from eeckstein/fix-mowte
MoveOnlyWrappedTypeEliminator: handle open_existential_box instructions
2 parents 018ef6e + d293fd9 commit 488581f

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

lib/SILOptimizer/Mandatory/MoveOnlyWrappedTypeEliminator.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ struct SILMoveOnlyWrappedTypeEliminatorVisitor
199199
NO_UPDATE_NEEDED(Object)
200200
NO_UPDATE_NEEDED(OpenExistentialRef)
201201
NO_UPDATE_NEEDED(OpenExistentialAddr)
202+
NO_UPDATE_NEEDED(OpenExistentialBox)
202203
NO_UPDATE_NEEDED(ConvertFunction)
203204
NO_UPDATE_NEEDED(RefToBridgeObject)
204205
NO_UPDATE_NEEDED(BridgeObjectToRef)

test/SILOptimizer/moveonly_type_eliminator.sil

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
sil_stage raw
55

66
import Builtin
7+
import Swift
78

89
//////////////////
910
// Declarations //
@@ -38,8 +39,6 @@ struct KlassPair {
3839

3940
sil @use_klass : $@convention(thin) (@guaranteed Klass) -> ()
4041

41-
protocol Error {}
42-
4342
///////////
4443
// Tests //
4544
///////////
@@ -616,6 +615,17 @@ bb0(%x : @guaranteed $any Error):
616615
return %em : $@thick any Error.Type
617616
}
618617

618+
// CHECK-LABEL: sil [ossa] @existential_box :
619+
// CHECK: %1 = open_existential_box %0 : $any Error
620+
// CHECK-LABEL: } // end sil function 'existential_box'
621+
sil [ossa] @existential_box : $@convention(thin) (@guaranteed any Error) -> () {
622+
bb0(%x : @guaranteed $any Error):
623+
%y = copyable_to_moveonlywrapper [guaranteed] %x : $any Error
624+
%o = open_existential_box %y : $@moveOnly (any Error) to $*@opened("01234567-89AB-CDEF-0123-000000000000", Error) Self
625+
%r = tuple ()
626+
return %r : $()
627+
}
628+
619629
// CHECK-LABEL: sil [ossa] @builtin_tsanInoutAccess : {{.*}} {
620630
// CHECK: builtin "tsanInoutAccess"
621631
// CHECK-LABEL: } // end sil function 'builtin_tsanInoutAccess'

0 commit comments

Comments
 (0)