-
Notifications
You must be signed in to change notification settings - Fork 10.4k
/
Copy pathmoveonly_ownership.sil
165 lines (152 loc) · 6.75 KB
/
moveonly_ownership.sil
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
// RUN: %target-sil-opt -test-runner %s -o /dev/null 2>&1 | %FileCheck %s
sil_stage raw
import Builtin
import Swift
import SwiftShims
struct FakeInt {
var i: Builtin.Int32
}
struct MO_DEINIT: ~Copyable {
@_hasStorage var value: FakeInt { get set }
deinit
init(value: FakeInt)
}
struct NC_DEINIT : ~Copyable {
@_hasStorage var value: FakeInt { get set }
deinit
init(value: FakeInt)
}
struct MO: ~Copyable {
@_hasStorage var value: FakeInt { get set }
}
struct NC : ~Copyable {
@_hasStorage var value: FakeInt { get set }
}
// CHECK: begin running test 1 of 4 on motest1: is_sil_trivial with: @instruction[2]
// CHECK: %2 = struct $MO_DEINIT (%1 : $FakeInt)
// CHECK: is not trivial
// CHECK: end running test 1 of 4 on motest1: is_sil_trivial with: @instruction[2]
// CHECK: begin running test 2 of 4 on motest1: get_ownership_kind with: @instruction[2]
// CHECK: %2 = struct $MO_DEINIT (%1 : $FakeInt)
// CHECK: OwnershipKind: owned
// CHECK: end running test 2 of 4 on motest1: get_ownership_kind with: @instruction[2]
// CHECK: begin running test 3 of 4 on motest1: is_sil_trivial with: @instruction[4]
// CHECK: %4 = move_value [lexical] %2 : $MO_DEINIT
// CHECK: is not trivial
// CHECK: end running test 3 of 4 on motest1: is_sil_trivial with: @instruction[4]
// CHECK: begin running test 4 of 4 on motest1: get_ownership_kind with: @instruction[4]
// CHECK: %4 = move_value [lexical] %2 : $MO_DEINIT
// CHECK: OwnershipKind: owned
// CHECK: end running test 4 of 4 on motest1: get_ownership_kind with: @instruction[4]
sil hidden [ossa] @motest1 : $@convention(thin) () -> () {
[global: read,write,copy,destroy,allocate,deinit_barrier]
bb0:
specify_test "is_sil_trivial @instruction[2]"
specify_test "get_ownership_kind @instruction[2]"
specify_test "is_sil_trivial @instruction[4]"
specify_test "get_ownership_kind @instruction[4]"
%0 = integer_literal $Builtin.Int32, 38
%1 = struct $FakeInt (%0 : $Builtin.Int32)
%2 = struct $MO_DEINIT (%1 : $FakeInt)
debug_value %2 : $MO_DEINIT, let, name "b"
%4 = move_value [lexical] %2 : $MO_DEINIT
destroy_value %4 : $MO_DEINIT
%6 = tuple ()
return %6 : $()
}
// CHECK: begin running test 1 of 4 on motest2: is_sil_trivial with: @instruction[2]
// CHECK: %2 = struct $MO (%1 : $FakeInt)
// CHECK: is not trivial
// CHECK: end running test 1 of 4 on motest2: is_sil_trivial with: @instruction[2]
// CHECK: begin running test 2 of 4 on motest2: get_ownership_kind with: @instruction[2]
// CHECK: %2 = struct $MO (%1 : $FakeInt)
// CHECK: OwnershipKind: owned
// CHECK: end running test 2 of 4 on motest2: get_ownership_kind with: @instruction[2]
// CHECK: begin running test 3 of 4 on motest2: is_sil_trivial with: @instruction[4]
// CHECK: %4 = move_value [lexical] %2 : $MO
// CHECK: is not trivial
// CHECK: end running test 3 of 4 on motest2: is_sil_trivial with: @instruction[4]
// CHECK: begin running test 4 of 4 on motest2: get_ownership_kind with: @instruction[4]
// CHECK: %4 = move_value [lexical] %2 : $MO
// CHECK: OwnershipKind: owned
// CHECK: end running test 4 of 4 on motest2: get_ownership_kind with: @instruction[4]
sil hidden [ossa] @motest2 : $@convention(thin) () -> () {
[global: read,write,copy,destroy,allocate,deinit_barrier]
bb0:
specify_test "is_sil_trivial @instruction[2]"
specify_test "get_ownership_kind @instruction[2]"
specify_test "is_sil_trivial @instruction[4]"
specify_test "get_ownership_kind @instruction[4]"
%0 = integer_literal $Builtin.Int32, 38
%1 = struct $FakeInt (%0 : $Builtin.Int32)
%2 = struct $MO (%1 : $FakeInt)
debug_value %2 : $MO, let, name "b"
%4 = move_value [lexical] %2 : $MO
destroy_value %4 : $MO
%6 = tuple ()
return %6 : $()
}
// CHECK: begin running test 1 of 4 on nctest1: is_sil_trivial with: @instruction[2]
// CHECK: %2 = struct $NC_DEINIT (%1 : $FakeInt)
// CHECK: is not trivial
// CHECK: end running test 1 of 4 on nctest1: is_sil_trivial with: @instruction[2]
// CHECK: begin running test 2 of 4 on nctest1: get_ownership_kind with: @instruction[2]
// CHECK: %2 = struct $NC_DEINIT (%1 : $FakeInt)
// CHECK: OwnershipKind: owned
// CHECK: end running test 2 of 4 on nctest1: get_ownership_kind with: @instruction[2]
// CHECK: begin running test 3 of 4 on nctest1: is_sil_trivial with: @instruction[4]
// CHECK: %4 = move_value [lexical] %2 : $NC_DEINIT
// CHECK: is not trivial
// CHECK: end running test 3 of 4 on nctest1: is_sil_trivial with: @instruction[4]
// CHECK: begin running test 4 of 4 on nctest1: get_ownership_kind with: @instruction[4]
// CHECK: %4 = move_value [lexical] %2 : $NC_DEINIT
// CHECK: OwnershipKind: owned
// CHECK: end running test 4 of 4 on nctest1: get_ownership_kind with: @instruction[4]
sil hidden [ossa] @nctest1 : $@convention(thin) () -> () {
[global: read,write,copy,destroy,allocate,deinit_barrier]
bb0:
specify_test "is_sil_trivial @instruction[2]"
specify_test "get_ownership_kind @instruction[2]"
specify_test "is_sil_trivial @instruction[4]"
specify_test "get_ownership_kind @instruction[4]"
%0 = integer_literal $Builtin.Int32, 38
%1 = struct $FakeInt (%0 : $Builtin.Int32)
%2 = struct $NC_DEINIT (%1 : $FakeInt)
debug_value %2 : $NC_DEINIT, let, name "b"
%4 = move_value [lexical] %2 : $NC_DEINIT
destroy_value %4 : $NC_DEINIT
%6 = tuple ()
return %6 : $()
}
// CHECK: begin running test 1 of 4 on nctest2: is_sil_trivial with: @instruction[2]
// CHECK: %2 = struct $NC (%1 : $FakeInt)
// CHECK: is not trivial
// CHECK: end running test 1 of 4 on nctest2: is_sil_trivial with: @instruction[2]
// CHECK: begin running test 2 of 4 on nctest2: get_ownership_kind with: @instruction[2]
// CHECK: %2 = struct $NC (%1 : $FakeInt)
// CHECK: OwnershipKind: owned
// CHECK: end running test 2 of 4 on nctest2: get_ownership_kind with: @instruction[2]
// CHECK: begin running test 3 of 4 on nctest2: is_sil_trivial with: @instruction[4]
// CHECK: %4 = move_value [lexical] %2 : $NC
// CHECK: is not trivial
// CHECK: end running test 3 of 4 on nctest2: is_sil_trivial with: @instruction[4]
// CHECK: begin running test 4 of 4 on nctest2: get_ownership_kind with: @instruction[4]
// CHECK: %4 = move_value [lexical] %2 : $NC
// CHECK: OwnershipKind: owned
// CHECK: end running test 4 of 4 on nctest2: get_ownership_kind with: @instruction[4]
sil hidden [ossa] @nctest2 : $@convention(thin) () -> () {
[global: read,write,copy,destroy,allocate,deinit_barrier]
bb0:
specify_test "is_sil_trivial @instruction[2]"
specify_test "get_ownership_kind @instruction[2]"
specify_test "is_sil_trivial @instruction[4]"
specify_test "get_ownership_kind @instruction[4]"
%0 = integer_literal $Builtin.Int32, 38
%1 = struct $FakeInt (%0 : $Builtin.Int32)
%2 = struct $NC (%1 : $FakeInt)
debug_value %2 : $NC, let, name "b"
%4 = move_value [lexical] %2 : $NC
destroy_value %4 : $NC
%6 = tuple ()
return %6 : $()
}