File: moveonly_addresschecker_di_interactions.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 (62 lines) | stat: -rw-r--r-- 2,304 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
61
62
// RUN: %target-sil-opt -definite-init %s | %FileCheck %s

// Make sure that DI properly converts mark_unresolved_non_copyable_value
// [assignable_but_not_consumable] -> mark_unresolved_non_copyable_value
// [initable_but_not_consumable].

sil_stage raw

import Swift

fileprivate final class _Box<T> {
  var value: _Node<T>

  init(_ value: consuming _Node<T>)
}

struct _Node<T> : ~Copyable {
  var value: T
  var _next: ListEntry<T>

  init(_ newValue: T)
}

struct ListEntry<T> : ~Copyable {
  private var innerBox: _Box<T>
}

// CHECK-LABEL: sil private [ossa] @boxInit : $@convention(method) <T> (@in _Node<T>, @owned _Box<T>) -> @owned _Box<T> {
// CHECK: bb0([[INPUT:%.*]] : $*_Node<T>, %1 : @owned
// CHECK:   [[SELF:%.*]] = mark_uninitialized [rootself] %1
// CHECK:   [[BORROW_SELF:%.*]] = begin_borrow [[SELF]]
// CHECK:   [[REF:%.*]] = ref_element_addr [[BORROW_SELF]]
// CHECK:   [[ACCESS:%.*]] = begin_access [modify] [dynamic] [[REF]]
// CHECK:   [[MARK:%.*]] = mark_unresolved_non_copyable_value [initable_but_not_consumable] [[ACCESS]]
// CHECK:   copy_addr [take] {{%.*}} to [init] [[MARK]]
// CHECK:   end_access [[ACCESS]]
// CHECK: } // end sil function 'boxInit'
sil private [ossa] @boxInit : $@convention(method) <T> (@in _Node<T>, @owned _Box<T>) -> @owned _Box<T> {
bb0(%0 : $*_Node<T>, %1 : @owned $_Box<T>):
  %2 = alloc_stack [lexical] $_Node<T>, var, name "value"
  %3 = mark_unresolved_non_copyable_value [consumable_and_assignable] %2 : $*_Node<T>
  copy_addr [take] %0 to [init] %3 : $*_Node<T>
  debug_value %1 : $_Box<T>, let, name "self", argno 2
  %6 = mark_uninitialized [rootself] %1 : $_Box<T>
  %7 = begin_borrow %6 : $_Box<T>
  %8 = begin_access [read] [static] %3 : $*_Node<T>
  %9 = alloc_stack $_Node<T>
  copy_addr %8 to [init] %9 : $*_Node<T>
  end_access %8 : $*_Node<T>
  %12 = ref_element_addr %7 : $_Box<T>, #_Box.value
  %13 = begin_access [modify] [dynamic] %12 : $*_Node<T>
  %14 = mark_unresolved_non_copyable_value [assignable_but_not_consumable] %13 : $*_Node<T>
  copy_addr [take] %9 to %14 : $*_Node<T>
  end_access %13 : $*_Node<T>
  dealloc_stack %9 : $*_Node<T>
  end_borrow %7 : $_Box<T>
  %19 = copy_value %6 : $_Box<T>
  destroy_value %6 : $_Box<T>
  destroy_addr %3 : $*_Node<T>
  dealloc_stack %2 : $*_Node<T>
  return %19 : $_Box<T>
}