mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Adding `move_value [lexical]` and `begin_borrow [lexical]` should happen all the time at this point. Remove the ability to omit these instructions and update the corresponding tests.
50 lines
2.2 KiB
Plaintext
50 lines
2.2 KiB
Plaintext
// RUN: %target-sil-opt -enable-sil-verify-all %s -allocbox-to-stack -enable-copy-propagation=requested-passes-only | %FileCheck %s
|
|
|
|
sil_stage raw
|
|
|
|
protocol P {}
|
|
|
|
|
|
sil [ossa] @callWithAutoclosure_3 : $@convention(thin) <T where T : P> (@in T) -> () {
|
|
bb0(%0 : $*T):
|
|
debug_value %0 : $*T, expr op_deref
|
|
%2 = function_ref @mightApply : $@convention(thin) <τ_0_0 where τ_0_0 : P> (@owned @callee_owned () -> @out τ_0_0) -> ()
|
|
%3 = function_ref @closure_to_specialize : $@convention(thin) <τ_0_0 where τ_0_0 : P> (@owned <τ_0_0> { var τ_0_0 } <τ_0_0>) -> @out τ_0_0
|
|
%4 = alloc_box $<τ_0_0> { var τ_0_0 } <T>
|
|
%4c = mark_uninitialized [var] %4 : $<τ_0_0> { var τ_0_0 } <T>
|
|
%4a = project_box %4c : $<τ_0_0> { var τ_0_0 } <T>, 0
|
|
%4copy = copy_value %4c : $<τ_0_0> { var τ_0_0 } <T>
|
|
copy_addr %0 to [init] %4a : $*T
|
|
%6 = partial_apply %3<T>(%4copy) : $@convention(thin) <τ_0_0 where τ_0_0 : P> (@owned <τ_0_0> { var τ_0_0 } <τ_0_0>) -> @out τ_0_0
|
|
%7 = apply %2<T>(%6) : $@convention(thin) <τ_0_0 where τ_0_0 : P> (@owned @callee_owned () -> @out τ_0_0) -> ()
|
|
destroy_addr %0 : $*T
|
|
destroy_value %4c : $<τ_0_0> { var τ_0_0 } <T>
|
|
%9 = tuple ()
|
|
return %9 : $()
|
|
}
|
|
|
|
// CHECK-LABEL: sil {{.*}}@$s21closure_to_specializeTf0ns_n : {{.*}}{
|
|
// CHECK: {{bb[0-9]+}}({{%[^,]+}} : @_eagerMove $*T, {{%[^,]+}} : @_eagerMove $
|
|
// CHECK-LABEL: } // end sil function '$s21closure_to_specializeTf0ns_n'
|
|
sil shared [ossa] @closure_to_specialize : $@convention(thin) <T where T : P> (@owned <τ_0_0> { var τ_0_0 } <T>) -> @out T {
|
|
bb0(%0 : @_eagerMove $*T, %1 : @_eagerMove @owned $<τ_0_0> { var τ_0_0 } <T>):
|
|
%2 = project_box %1 : $<τ_0_0> { var τ_0_0 } <T>, 0
|
|
copy_addr %2 to [init] %0 : $*T
|
|
destroy_value %1 : $<τ_0_0> { var τ_0_0 } <T>
|
|
%5 = tuple ()
|
|
return %5 : $()
|
|
}
|
|
|
|
sil [transparent] [serialized] [ossa] @mightApply : $@convention(thin) <U where U : P> (@owned @callee_owned () -> @out U) -> () {
|
|
bb0(%0 : @owned $@callee_owned () -> @out U):
|
|
debug_value %0 : $@callee_owned () -> @out U
|
|
%1 = copy_value %0 : $@callee_owned () -> @out U
|
|
%3 = alloc_stack $U
|
|
%4 = apply %1(%3) : $@callee_owned () -> @out U
|
|
destroy_addr %3 : $*U
|
|
dealloc_stack %3 : $*U
|
|
destroy_value %0 : $@callee_owned () -> @out U
|
|
%8 = tuple ()
|
|
return %8 : $()
|
|
}
|