Skip to content

Commit

Permalink
Merge pull request #76715 from eeckstein/fix-mowte
Browse files Browse the repository at this point in the history
MoveOnlyWrappedTypeEliminator: handle open_existential_box instructions
  • Loading branch information
eeckstein authored Sep 26, 2024
2 parents 018ef6e + d293fd9 commit 488581f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ struct SILMoveOnlyWrappedTypeEliminatorVisitor
NO_UPDATE_NEEDED(Object)
NO_UPDATE_NEEDED(OpenExistentialRef)
NO_UPDATE_NEEDED(OpenExistentialAddr)
NO_UPDATE_NEEDED(OpenExistentialBox)
NO_UPDATE_NEEDED(ConvertFunction)
NO_UPDATE_NEEDED(RefToBridgeObject)
NO_UPDATE_NEEDED(BridgeObjectToRef)
Expand Down
14 changes: 12 additions & 2 deletions test/SILOptimizer/moveonly_type_eliminator.sil
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
sil_stage raw

import Builtin
import Swift

//////////////////
// Declarations //
Expand Down Expand Up @@ -38,8 +39,6 @@ struct KlassPair {

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

protocol Error {}

///////////
// Tests //
///////////
Expand Down Expand Up @@ -616,6 +615,17 @@ bb0(%x : @guaranteed $any Error):
return %em : $@thick any Error.Type
}

// CHECK-LABEL: sil [ossa] @existential_box :
// CHECK: %1 = open_existential_box %0 : $any Error
// CHECK-LABEL: } // end sil function 'existential_box'
sil [ossa] @existential_box : $@convention(thin) (@guaranteed any Error) -> () {
bb0(%x : @guaranteed $any Error):
%y = copyable_to_moveonlywrapper [guaranteed] %x : $any Error
%o = open_existential_box %y : $@moveOnly (any Error) to $*@opened("01234567-89AB-CDEF-0123-000000000000", Error) Self
%r = tuple ()
return %r : $()
}

// CHECK-LABEL: sil [ossa] @builtin_tsanInoutAccess : {{.*}} {
// CHECK: builtin "tsanInoutAccess"
// CHECK-LABEL: } // end sil function 'builtin_tsanInoutAccess'
Expand Down

0 comments on commit 488581f

Please sign in to comment.