mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
61 lines
2.5 KiB
Plaintext
61 lines
2.5 KiB
Plaintext
// RUN: %target-sil-opt %s -verify -closure-specialize -assume-parsing-unqualified-ownership-sil -o - | %FileCheck %s
|
|
|
|
// Make sure we do not specialize resilientCallee.
|
|
|
|
sil_stage canonical
|
|
|
|
import Builtin
|
|
import Swift
|
|
import SwiftShims
|
|
|
|
@_optimize(none) public func action()
|
|
|
|
@inline(__always) public func fragileCaller()
|
|
|
|
public func resilientCallee(fn: () -> ())
|
|
|
|
// action()
|
|
sil [Onone] @_T026closure_specialize_fragile6actionyyF : $@convention(thin) () -> () {
|
|
bb0:
|
|
%0 = tuple ()
|
|
return %0 : $()
|
|
} // end sil function '_T026closure_specialize_fragile6actionyyF'
|
|
|
|
// CHECK-LABEL: sil [serialized] [always_inline] @_T026closure_specialize_fragile0C6CalleryyF : $@convention(thin) () -> ()
|
|
// CHECK: function_ref @_T026closure_specialize_fragile15resilientCalleeyyyc2fn_tF : $@convention(thin) (@owned @callee_owned () -> ()) -> ()
|
|
// CHECK: return
|
|
// fragileCaller()
|
|
sil [serialized] [always_inline] @_T026closure_specialize_fragile0C6CalleryyF : $@convention(thin) () -> () {
|
|
bb0:
|
|
// function_ref resilientCallee(fn:)
|
|
%0 = function_ref @_T026closure_specialize_fragile15resilientCalleeyyyc2fn_tF : $@convention(thin) (@owned @callee_owned () -> ()) -> ()
|
|
// function_ref closure #1 in fragileCaller()
|
|
%1 = function_ref @_T026closure_specialize_fragile0C6CalleryyFyycfU_ : $@convention(thin) () -> ()
|
|
%2 = thin_to_thick_function %1 : $@convention(thin) () -> () to $@callee_owned () -> ()
|
|
%3 = apply %0(%2) : $@convention(thin) (@owned @callee_owned () -> ()) -> ()
|
|
%4 = tuple ()
|
|
return %4 : $()
|
|
} // end sil function '_T026closure_specialize_fragile0C6CalleryyF'
|
|
|
|
// CHECK-LABEL: sil @_T026closure_specialize_fragile15resilientCalleeyyyc2fn_tF : $@convention(thin) (@owned @callee_owned () -> ()) -> ()
|
|
|
|
// resilientCallee(fn:)
|
|
sil @_T026closure_specialize_fragile15resilientCalleeyyyc2fn_tF : $@convention(thin) (@owned @callee_owned () -> ()) -> () {
|
|
bb0(%0 : $@callee_owned () -> ()):
|
|
strong_retain %0 : $@callee_owned () -> ()
|
|
%3 = apply %0() : $@callee_owned () -> ()
|
|
strong_release %0 : $@callee_owned () -> ()
|
|
%5 = tuple ()
|
|
return %5 : $()
|
|
} // end sil function '_T026closure_specialize_fragile15resilientCalleeyyyc2fn_tF'
|
|
|
|
// closure #1 in fragileCaller()
|
|
sil shared [serialized] @_T026closure_specialize_fragile0C6CalleryyFyycfU_ : $@convention(thin) () -> () {
|
|
bb0:
|
|
// function_ref action()
|
|
%0 = function_ref @_T026closure_specialize_fragile6actionyyF : $@convention(thin) () -> ()
|
|
%1 = apply %0() : $@convention(thin) () -> ()
|
|
%2 = tuple ()
|
|
return %2 : $()
|
|
} // end sil function '_T026closure_specialize_fragile0C6CalleryyFyycfU_'
|