File: closure_specialize_fragile.sil

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,519,992 kB
  • sloc: cpp: 9,107,863; ansic: 2,040,022; asm: 1,135,751; python: 296,500; objc: 82,456; f90: 60,502; lisp: 34,951; pascal: 19,946; sh: 18,133; perl: 7,482; ml: 4,937; javascript: 4,117; makefile: 3,840; awk: 3,535; xml: 914; fortran: 619; cs: 573; ruby: 573
file content (60 lines) | stat: -rw-r--r-- 2,536 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
// RUN: %target-sil-opt  %s -verify -closure-specialize -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] @$s26closure_specialize_fragile6actionyyF : $@convention(thin) () -> () {
bb0:
  %0 = tuple ()
  return %0 : $()
} // end sil function '$s26closure_specialize_fragile6actionyyF'

// CHECK-LABEL: sil [serialized] [always_inline] @$s26closure_specialize_fragile0C6CalleryyF : $@convention(thin) () -> ()
// CHECK: function_ref @$s26closure_specialize_fragile15resilientCalleeyyyc2fn_tF : $@convention(thin) (@owned @callee_owned () -> ()) -> ()
// CHECK: return
// fragileCaller()
sil [serialized] [always_inline] @$s26closure_specialize_fragile0C6CalleryyF : $@convention(thin) () -> () {
bb0:
  // function_ref resilientCallee(fn:)
  %0 = function_ref @$s26closure_specialize_fragile15resilientCalleeyyyc2fn_tF : $@convention(thin) (@owned @callee_owned () -> ()) -> ()
  // function_ref closure #1 in fragileCaller()
  %1 = function_ref @$s26closure_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 '$s26closure_specialize_fragile0C6CalleryyF'

// CHECK-LABEL: sil @$s26closure_specialize_fragile15resilientCalleeyyyc2fn_tF : $@convention(thin) (@owned @callee_owned () -> ()) -> ()

// resilientCallee(fn:)
sil @$s26closure_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 '$s26closure_specialize_fragile15resilientCalleeyyyc2fn_tF'

// closure #1 in fragileCaller()
sil shared [serialized] @$s26closure_specialize_fragile0C6CalleryyFyycfU_ : $@convention(thin) () -> () {
bb0:
  // function_ref action()
  %0 = function_ref @$s26closure_specialize_fragile6actionyyF : $@convention(thin) () -> () 
  %1 = apply %0() : $@convention(thin) () -> ()
  %2 = tuple ()
  return %2 : $()
} // end sil function '$s26closure_specialize_fragile0C6CalleryyFyycfU_'