File: allocbox_to_stack_ownership_attrs.sil

package info (click to toggle)
swiftlang 6.1.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,791,532 kB
  • sloc: cpp: 9,901,743; ansic: 2,201,431; asm: 1,091,827; python: 308,252; objc: 82,166; f90: 80,126; lisp: 38,358; pascal: 25,559; sh: 20,429; ml: 5,058; perl: 4,745; makefile: 4,484; awk: 3,535; javascript: 3,018; xml: 918; fortran: 664; cs: 573; ruby: 396
file content (49 lines) | stat: -rw-r--r-- 2,303 bytes parent folder | download | duplicates (2)
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
// 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 : $()
}