forked from swiftlang/swift
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcapture_promotion_ownership.sil
330 lines (285 loc) · 16.3 KB
/
capture_promotion_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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
// RUN: %target-sil-opt -enable-sil-verify-all %s -capture-promotion -enable-sil-ownership | %FileCheck %s
// Check to make sure that the process of promoting closure captures results in
// a correctly cloned and modified closure function body. This test
// intentionally only includes one promotable closure so that there is minimal
// ordering dependence in the checked output.
sil_stage raw
import Builtin
struct Int {
var value : Builtin.Int64
}
class Foo {
func foo() -> Int
}
class Bar {
}
struct Baz {
var bar: Bar
var x: Int
}
sil @convert_from_integer_literal : $@convention(thin) (Builtin.Word, @thin Int.Type) -> Int
sil @foo_allocating_init : $@convention(thin) (@thick Foo.Type) -> @owned Foo
sil @baz_init : $@convention(thin) (@thin Baz.Type) -> @owned Baz
sil @dummy_func : $@convention(thin) (Int, Int, Int) -> Int
// CHECK-LABEL: sil @test_capture_promotion
sil @test_capture_promotion : $@convention(thin) () -> @owned @callee_owned () -> Int {
bb0:
// CHECK: [[BOX1:%.*]] = alloc_box $<τ_0_0> { var τ_0_0 } <Foo>
// CHECK: [[MARKED_BOX1:%.*]] = mark_uninitialized [var] [[BOX1]]
%1 = alloc_box $<τ_0_0> { var τ_0_0 } <Foo>
%1ab = mark_uninitialized [var] %1 : $<τ_0_0> { var τ_0_0 } <Foo>
%1a = project_box %1ab : $<τ_0_0> { var τ_0_0 } <Foo>, 0
%2 = function_ref @foo_allocating_init : $@convention(thin) (@thick Foo.Type) -> @owned Foo
%3 = metatype $@thick Foo.Type
%4 = apply %2(%3) : $@convention(thin) (@thick Foo.Type) -> @owned Foo
store %4 to [init] %1a : $*Foo
// CHECK: [[BOX2:%.*]] = alloc_box $<τ_0_0> { var τ_0_0 } <Baz>
%6 = alloc_box $<τ_0_0> { var τ_0_0 } <Baz>
%6a = project_box %6 : $<τ_0_0> { var τ_0_0 } <Baz>, 0
%7 = function_ref @baz_init : $@convention(thin) (@thin Baz.Type) -> @owned Baz
%8 = metatype $@thin Baz.Type
%9 = apply %7(%8) : $@convention(thin) (@thin Baz.Type) -> @owned Baz
store %9 to [init] %6a : $*Baz
// CHECK: [[BOX3:%.*]] = alloc_box $<τ_0_0> { var τ_0_0 } <Int>
%11 = alloc_box $<τ_0_0> { var τ_0_0 } <Int>
%11a = project_box %11 : $<τ_0_0> { var τ_0_0 } <Int>, 0
%12 = function_ref @convert_from_integer_literal : $@convention(thin) (Builtin.Word, @thin Int.Type) -> Int
%13 = metatype $@thin Int.Type
%14 = integer_literal $Builtin.Word, 3
%15 = apply %12(%14, %13) : $@convention(thin) (Builtin.Word, @thin Int.Type) -> Int
store %15 to [trivial] %11a : $*Int
// CHECK: [[BOX1_COPY:%.*]] = copy_value [[MARKED_BOX1]]
// CHECK: [[BOX1_COPY_PB:%.*]] = project_box [[BOX1_COPY]]
// CHECK: [[BOX2_COPY:%.*]] = copy_value [[BOX2]]
// CHECK: [[BOX2_COPY_PB:%.*]] = project_box [[BOX2_COPY]]
// CHECK: [[BOX3_COPY:%.*]] = copy_value [[BOX3]]
// CHECK: [[BOX3_COPY_PB:%.*]] = project_box [[BOX3_COPY]]
// CHECK-NOT: function_ref @closure0 :
// CHECK: [[CLOSURE_PROMOTE:%.*]] = function_ref @_T08closure0Tf2iii_n
// CHECK-NOT: function_ref @closure0 :
// The Foo variable is loaded from and retained, because it is a reference type
// CHECK-NEXT: [[LOADFOO:%.*]] = load [copy] [[BOX1_COPY_PB]] : $*Foo
// CHECK-NEXT: destroy_value [[BOX1_COPY]]
//
// The Baz variable is loaded and copied, because it is a non-trivial
// aggregate type
// CHECK-NEXT: [[LOADBAZ:%.*]] = load [copy] [[BOX2_COPY_PB]] : $*Baz
// CHECK-NEXT: destroy_value [[BOX2_COPY]]
// The Int variable is loaded only, because it is trivial
// CHECK-NEXT: [[LOADINT:%.*]] = load [trivial] [[BOX3_COPY_PB]] : $*Int
// CHECK-NEXT: destroy_value [[BOX3_COPY]]
// The partial apply has one value argument for each pair of arguments that was
// previously used to capture and pass the variable by reference
// CHECK-NEXT: {{.*}} = partial_apply [[CLOSURE_PROMOTE]]([[LOADFOO]], [[LOADBAZ]], [[LOADINT]])
%17 = function_ref @closure0 : $@convention(thin) (@owned <τ_0_0> { var τ_0_0 } <Foo>, @owned <τ_0_0> { var τ_0_0 } <Baz>, @owned <τ_0_0> { var τ_0_0 } <Int>) -> Int
%18 = copy_value %1ab : $<τ_0_0> { var τ_0_0 } <Foo>
%19 = copy_value %6 : $<τ_0_0> { var τ_0_0 } <Baz>
%20 = copy_value %11 : $<τ_0_0> { var τ_0_0 } <Int>
%21 = partial_apply %17(%18, %19, %20) : $@convention(thin) (@owned <τ_0_0> { var τ_0_0 } <Foo>, @owned <τ_0_0> { var τ_0_0 } <Baz>, @owned <τ_0_0> { var τ_0_0 } <Int>) -> Int
destroy_value %11 : $<τ_0_0> { var τ_0_0 } <Int>
destroy_value %6 : $<τ_0_0> { var τ_0_0 } <Baz>
destroy_value %1ab : $<τ_0_0> { var τ_0_0 } <Foo>
return %21 : $@callee_owned () -> Int
}
// CHECK-LABEL: sil @test_capture_promotion_indirect
sil @test_capture_promotion_indirect : $@convention(thin) () -> @owned @callee_owned () -> @out Int {
bb0:
// CHECK: [[BOX1:%.*]] = alloc_box $<τ_0_0> { var τ_0_0 } <Foo>
%1 = alloc_box $<τ_0_0> { var τ_0_0 } <Foo>
%1a = project_box %1 : $<τ_0_0> { var τ_0_0 } <Foo>, 0
%2 = function_ref @foo_allocating_init : $@convention(thin) (@thick Foo.Type) -> @owned Foo
%3 = metatype $@thick Foo.Type
%4 = apply %2(%3) : $@convention(thin) (@thick Foo.Type) -> @owned Foo
store %4 to [init] %1a : $*Foo
// CHECK: [[BOX2:%.*]] = alloc_box $<τ_0_0> { var τ_0_0 } <Baz>
%6 = alloc_box $<τ_0_0> { var τ_0_0 } <Baz>
%6a = project_box %6 : $<τ_0_0> { var τ_0_0 } <Baz>, 0
%7 = function_ref @baz_init : $@convention(thin) (@thin Baz.Type) -> @owned Baz
%8 = metatype $@thin Baz.Type
%9 = apply %7(%8) : $@convention(thin) (@thin Baz.Type) -> @owned Baz
store %9 to [init] %6a : $*Baz
// CHECK: [[BOX3:%.*]] = alloc_box $<τ_0_0> { var τ_0_0 } <Int>
%11 = alloc_box $<τ_0_0> { var τ_0_0 } <Int>
%11a = project_box %11 : $<τ_0_0> { var τ_0_0 } <Int>, 0
%12 = function_ref @convert_from_integer_literal : $@convention(thin) (Builtin.Word, @thin Int.Type) -> Int
%13 = metatype $@thin Int.Type
%14 = integer_literal $Builtin.Word, 3
%15 = apply %12(%14, %13) : $@convention(thin) (Builtin.Word, @thin Int.Type) -> Int
store %15 to [trivial] %11a : $*Int
// CHECK: [[BOX1_COPY:%.*]] = copy_value [[BOX1]]
// CHECK: [[BOX1_COPY_PB:%.*]] = project_box [[BOX1_COPY]]
// CHECK: [[BOX2_COPY:%.*]] = copy_value [[BOX2]]
// CHECK: [[BOX2_COPY_PB:%.*]] = project_box [[BOX2_COPY]]
// CHECK: [[BOX3_COPY:%.*]] = copy_value [[BOX3]]
// CHECK: [[BOX3_COPY_PB:%.*]] = project_box [[BOX3_COPY]]
// CHECK-NOT: function_ref @closure_indirect_result :
// CHECK: [[CLOSURE_PROMOTE:%.*]] = function_ref @_T023closure_indirect_resultTf2niii_n
// CHECK-NOT: function_ref @closure_indirect_result :
%17 = function_ref @closure_indirect_result : $@convention(thin) (@owned <τ_0_0> { var τ_0_0 } <Foo>, @owned <τ_0_0> { var τ_0_0 } <Baz>, @owned <τ_0_0> { var τ_0_0 } <Int>) -> @out Int
// CHECK-NEXT: [[LOADFOO:%.*]] = load [copy] [[BOX1_COPY_PB]] : $*Foo
// CHECK-NEXT: destroy_value [[BOX1_COPY]]
// CHECK-NEXT: [[LOADBAZ:%.*]] = load [copy] [[BOX2_COPY_PB]] : $*Baz
// CHECK-NEXT: destroy_value [[BOX2_COPY]]
// CHECK-NEXT: [[LOADINT:%.*]] = load [trivial] [[BOX3_COPY_PB]] : $*Int
// CHECK-NEXT: destroy_value [[BOX3_COPY]]
%18 = copy_value %1 : $<τ_0_0> { var τ_0_0 } <Foo>
%19 = copy_value %6 : $<τ_0_0> { var τ_0_0 } <Baz>
%20 = copy_value %11 : $<τ_0_0> { var τ_0_0 } <Int>
// The partial apply has one value argument for each pair of arguments that was
// previously used to capture and pass the variable by reference
// CHECK-NEXT: {{.*}} = partial_apply [[CLOSURE_PROMOTE]]([[LOADFOO]], [[LOADBAZ]], [[LOADINT]])
%21 = partial_apply %17(%18, %19, %20) : $@convention(thin) (@owned <τ_0_0> { var τ_0_0 } <Foo>, @owned <τ_0_0> { var τ_0_0 } <Baz>, @owned <τ_0_0> { var τ_0_0 } <Int>) -> @out Int
destroy_value %11 : $<τ_0_0> { var τ_0_0 } <Int>
destroy_value %6 : $<τ_0_0> { var τ_0_0 } <Baz>
destroy_value %1 : $<τ_0_0> { var τ_0_0 } <Foo>
return %21 : $@callee_owned () -> @out Int
}
// CHECK-LABEL: sil private @_T08closure0Tf2iii_n : $@convention(thin) (@owned Foo, @owned Baz, Int) -> Int {
// CHECK: bb0([[ORIGINAL_ARG0:%.*]] : @owned $Foo, [[ORIGINAL_ARG1:%.*]] : @owned $Baz, [[ARG2:%.*]] : @trivial $Int):
// CHECK: [[ARG0:%.*]] = begin_borrow [[ORIGINAL_ARG0]]
// CHECK: [[ARG1:%.*]] = begin_borrow [[ORIGINAL_ARG1]]
// CHECK: [[DUMMY_FUNC:%.*]] = function_ref @dummy_func : $@convention(thin) (Int, Int, Int) -> Int
// CHECK: [[ARG0_COPY:%.*]] = copy_value [[ARG0]]
// CHECK: [[METHOD_FOO:%.*]] = class_method [[ARG0_COPY]] : $Foo, #Foo.foo!1 : (Foo) -> () -> Int, $@convention(method) (@guaranteed Foo) -> Int
// CHECK: [[BORROWED_ARG0_COPY:%.*]] = begin_borrow [[ARG0_COPY]]
// CHECK: [[APPLY_FOO:%.*]] = apply [[METHOD_FOO]]([[BORROWED_ARG0_COPY]]) : $@convention(method) (@guaranteed Foo) -> Int
// CHECK: end_borrow [[BORROWED_ARG0_COPY]] from [[ARG0_COPY]]
// CHECK: destroy_value [[ARG0_COPY]]
// CHECK: [[EXTRACT_BAZ_X:%.*]] = struct_extract [[ARG1]] : $Baz, #Baz.x
// CHECK: [[RETVAL:%.*]] = apply [[DUMMY_FUNC]]([[APPLY_FOO]], [[EXTRACT_BAZ_X]], {{.*}}) : $@convention(thin) (Int, Int, Int) -> Int
// The release of %4 is removed because the Int type is trivial
// The release of %2 is replaced by a release_value of the Baz argument, since
// it is a non-trivial aggregate
// CHECK: end_borrow [[ARG1]] from [[ORIGINAL_ARG1]]
// CHECK: destroy_value [[ORIGINAL_ARG1]] : $Baz
// The release of %0 is replaced by a strong_release of the Foo argument, since
// it is a reference type
// CHECK: end_borrow [[ARG0]] from [[ORIGINAL_ARG0]]
// CHECK: destroy_value [[ORIGINAL_ARG0]]
// CHECK: return [[RETVAL]] : $Int
// CHECK: } // end sil function '_T08closure0Tf2iii_n'
sil private @closure0 : $@convention(thin) (@owned <τ_0_0> { var τ_0_0 } <Foo>, @owned <τ_0_0> { var τ_0_0 } <Baz>, @owned <τ_0_0> { var τ_0_0 } <Int>) -> Int {
bb0(%0 : @owned $<τ_0_0> { var τ_0_0 } <Foo>, %2 : @owned $<τ_0_0> { var τ_0_0 } <Baz>, %4 : @owned $<τ_0_0> { var τ_0_0 } <Int>):
%1 = project_box %0 : $<τ_0_0> { var τ_0_0 } <Foo>, 0
%3 = project_box %2 : $<τ_0_0> { var τ_0_0 } <Baz>, 0
%5 = project_box %4 : $<τ_0_0> { var τ_0_0 } <Int>, 0
%6 = tuple ()
// function_ref test14.plus (a : Swift.Int, b : Swift.Int, c : Swift.Int) -> Swift.Int
%7 = function_ref @dummy_func : $@convention(thin) (Int, Int, Int) -> Int
%8 = load [copy] %1 : $*Foo
%10 = class_method %8 : $Foo, #Foo.foo!1 : (Foo) -> () -> Int, $@convention(method) (@guaranteed Foo) -> Int
%9 = begin_borrow %8 : $Foo
%11 = apply %10(%9) : $@convention(method) (@guaranteed Foo) -> Int
end_borrow %9 from %8 : $Foo, $Foo
destroy_value %8 : $Foo
%12 = struct_element_addr %3 : $*Baz, #Baz.x
%13 = load [trivial] %12 : $*Int
%14 = load [trivial] %5 : $*Int
%15 = apply %7(%11, %13, %14) : $@convention(thin) (Int, Int, Int) -> Int
destroy_value %4 : $<τ_0_0> { var τ_0_0 } <Int>
destroy_value %2 : $<τ_0_0> { var τ_0_0 } <Baz>
destroy_value %0 : $<τ_0_0> { var τ_0_0 } <Foo>
return %15 : $Int
}
// The closure in this function is not promotable because it mutates its argument
// CHECK-LABEL: sil @test_unpromotable
sil @test_unpromotable : $@convention(thin) () -> @owned @callee_owned () -> Int {
bb0:
%0 = tuple ()
%1 = alloc_box $<τ_0_0> { var τ_0_0 } <Foo>
%1a = project_box %1 : $<τ_0_0> { var τ_0_0 } <Foo>, 0
%2 = function_ref @foo_allocating_init : $@convention(thin) (@thick Foo.Type) -> @owned Foo
%3 = metatype $@thick Foo.Type
%4 = apply %2(%3) : $@convention(thin) (@thick Foo.Type) -> @owned Foo
store %4 to [init] %1a : $*Foo
%17 = function_ref @closure1 : $@convention(thin) (@owned <τ_0_0> { var τ_0_0 } <Foo>) -> Int
%18 = copy_value %1 : $<τ_0_0> { var τ_0_0 } <Foo>
// CHECK: partial_apply {{%.*}}({{%.*}})
%21 = partial_apply %17(%18) : $@convention(thin) (@owned <τ_0_0> { var τ_0_0 } <Foo>) -> Int
destroy_value %1 : $<τ_0_0> { var τ_0_0 } <Foo>
return %21 : $@callee_owned () -> Int
}
sil @mutate_foo : $@convention(thin) (@inout Foo) -> ()
sil private @closure1 : $@convention(thin) (@owned <τ_0_0> { var τ_0_0 } <Foo>) -> Int {
bb0(%0 : @owned $<τ_0_0> { var τ_0_0 } <Foo>):
%1 = project_box %0 : $<τ_0_0> { var τ_0_0 } <Foo>, 0
%6 = tuple ()
// function_ref test14.plus (a : Swift.Int, b : Swift.Int, c : Swift.Int) -> Swift.Int
%7 = function_ref @dummy_func : $@convention(thin) (Int, Int, Int) -> Int
%8 = load [copy] %1 : $*Foo
%10 = class_method %8 : $Foo, #Foo.foo!1 : (Foo) -> () -> Int, $@convention(method) (@guaranteed Foo) -> Int
%9 = begin_borrow %8 : $Foo
%11 = apply %10(%9) : $@convention(method) (@guaranteed Foo) -> Int
end_borrow %9 from %8 : $Foo, $Foo
destroy_value %8 : $Foo
%12 = function_ref @mutate_foo : $@convention(thin) (@inout Foo) -> ()
%13 = apply %12(%1) : $@convention(thin) (@inout Foo) -> ()
destroy_value %0 : $<τ_0_0> { var τ_0_0 } <Foo>
return %11 : $Int
}
sil @apply : $@convention(thin) (@owned @callee_owned () -> ()) -> ()
// CHECK-LABEL: sil @captureWithinGeneric
sil @captureWithinGeneric : $@convention(thin) <T> (@inout Int, @inout Int) -> () {
// CHECK: bb0
bb0(%0 : @trivial $*Int, %1 : @trivial $*Int):
%2 = alloc_box $<τ_0_0> { var τ_0_0 } <Int>
%2a = project_box %2 : $<τ_0_0> { var τ_0_0 } <Int>, 0
copy_addr %0 to [initialization] %2a : $*Int
%4 = alloc_box $<τ_0_0> { var τ_0_0 } <Int>
%4a = project_box %4 : $<τ_0_0> { var τ_0_0 } <Int>, 0
copy_addr %1 to [initialization] %4a : $*Int
%6 = function_ref @apply : $@convention(thin) (@owned @callee_owned () -> ()) -> ()
// CHECK: [[PROMOTED:%[0-9a-zA-Z]+]] = function_ref @_T027closureWithGenericSignatureTf2ni_n : $@convention(thin) <τ_0_0> (@owned <τ_0_0> { var τ_0_0 } <Int>, Int) -> ()
%7 = function_ref @closureWithGenericSignature : $@convention(thin) <τ_0_0> (@owned <τ_0_0> { var τ_0_0 } <Int>, @owned <τ_0_0> { var τ_0_0 } <Int>) -> ()
%8 = copy_value %4 : $<τ_0_0> { var τ_0_0 } <Int>
%9 = copy_value %2 : $<τ_0_0> { var τ_0_0 } <Int>
// CHECK: partial_apply [[PROMOTED]]<{{[^>]+}}>(
%10 = partial_apply %7<T>(%8, %9) : $@convention(thin) <τ_0_0> (@owned <τ_0_0> { var τ_0_0 } <Int>, @owned <τ_0_0> { var τ_0_0 } <Int>) -> ()
%11 = apply %6(%10) : $@convention(thin) (@owned @callee_owned () -> ()) -> ()
copy_addr %4a to %1 : $*Int
destroy_value %4 : $<τ_0_0> { var τ_0_0 } <Int>
copy_addr %2a to %0 : $*Int
destroy_value %2 : $<τ_0_0> { var τ_0_0 } <Int>
%16 = tuple ()
return %16 : $()
}
// CHECK: sil @_T027closureWithGenericSignatureTf2ni_n : $@convention(thin) <{{[^>]+}}> (@owned <τ_0_0> { var τ_0_0 } <Int>, Int) -> ()
sil @closureWithGenericSignature : $@convention(thin) <T> (@owned <τ_0_0> { var τ_0_0 } <Int>, @owned <τ_0_0> { var τ_0_0 } <Int>) -> () {
bb0(%0 : @owned $<τ_0_0> { var τ_0_0 } <Int>, %2 : @owned $<τ_0_0> { var τ_0_0 } <Int>):
%1 = project_box %0 : $<τ_0_0> { var τ_0_0 } <Int>, 0
%3 = project_box %2 : $<τ_0_0> { var τ_0_0 } <Int>, 0
%4 = function_ref @_T0s1poiSiSi_SitF : $@convention(thin) (Int, Int) -> Int
%5 = load [trivial] %3 : $*Int
%6 = load [trivial] %3 : $*Int
%7 = apply %4(%5, %6) : $@convention(thin) (Int, Int) -> Int
assign %7 to %1 : $*Int
destroy_value %2 : $<τ_0_0> { var τ_0_0 } <Int>
destroy_value %0 : $<τ_0_0> { var τ_0_0 } <Int>
%11 = tuple ()
return %11 : $()
}
sil [transparent] [serialized] @_T0s1poiSiSi_SitF : $@convention(thin) (Int, Int) -> Int
sil private @closure_indirect_result : $@convention(thin) (@owned <τ_0_0> { var τ_0_0 } <Foo>, @owned <τ_0_0> { var τ_0_0 } <Baz>, @owned <τ_0_0> { var τ_0_0 } <Int>) -> @out Int {
bb0(%0: @trivial $*Int, %1 : @owned $<τ_0_0> { var τ_0_0 } <Foo>, %2 : @owned $<τ_0_0> { var τ_0_0 } <Baz>, %4 : @owned $<τ_0_0> { var τ_0_0 } <Int>):
%17 = project_box %1 : $<τ_0_0> { var τ_0_0 } <Foo>, 0
%3 = project_box %2 : $<τ_0_0> { var τ_0_0 } <Baz>, 0
%5 = project_box %4 : $<τ_0_0> { var τ_0_0 } <Int>, 0
// function_ref test14.plus (a : Swift.Int, b : Swift.Int, c : Swift.Int) -> Swift.Int
%7 = function_ref @dummy_func : $@convention(thin) (Int, Int, Int) -> Int
%8 = load [copy] %17 : $*Foo
%10 = class_method %8 : $Foo, #Foo.foo!1 : (Foo) -> () -> Int, $@convention(method) (@guaranteed Foo) -> Int
%9 = begin_borrow %8 : $Foo
%11 = apply %10(%9) : $@convention(method) (@guaranteed Foo) -> Int
end_borrow %9 from %8 : $Foo, $Foo
destroy_value %8 : $Foo
%12 = struct_element_addr %3 : $*Baz, #Baz.x
%13 = load [trivial] %12 : $*Int
%14 = load [trivial] %5 : $*Int
%15 = apply %7(%11, %13, %14) : $@convention(thin) (Int, Int, Int) -> Int
destroy_value %4 : $<τ_0_0> { var τ_0_0 } <Int>
destroy_value %2 : $<τ_0_0> { var τ_0_0 } <Baz>
destroy_value %1 : $<τ_0_0> { var τ_0_0 } <Foo>
store %15 to [trivial] %0 : $*Int
%16 = tuple()
return %16 : $()
}