File: basic2.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 (472 lines) | stat: -rw-r--r-- 23,286 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
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
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
// RUN: %target-sil-opt %s -enable-experimental-feature ValueGenerics | %target-sil-opt -enable-experimental-feature ValueGenerics | %FileCheck %s

// REQUIRES: swift_feature_ValueGenerics

import Builtin
import Swift

class Klass {}
struct MoveOnlyPair: ~Copyable {
  var lhs: Klass
  var rhs: Klass
}

sil @getKlass : $@convention(thin) () -> (@owned Klass)

// CHECK-LABEL: sil [ossa] @test_copy_release_value
// CHECK: bb0([[T0:%[0-9]+]] : @owned $Builtin.NativeObject):
// CHECK-NEXT: [[COPY_RESULT:%.*]] = copy_value [[T0]] : $Builtin.NativeObject
// CHECK-NEXT: destroy_value [[T0]] : $Builtin.NativeObject
// CHECK-NEXT: return [[COPY_RESULT]]
sil [ossa] @test_copy_release_value : $@convention(thin) (@owned Builtin.NativeObject) -> @owned Builtin.NativeObject {
bb0(%0 : @owned $Builtin.NativeObject):
  %1 = copy_value %0 : $Builtin.NativeObject
  destroy_value %0 : $Builtin.NativeObject
  return %1 : $Builtin.NativeObject
}

// CHECK-LABEL: sil [ossa] @test_strong_copy_unowned_value : $@convention(thin) (@owned @sil_unowned Builtin.NativeObject) -> @owned Builtin.NativeObject {
// CHECK: bb0([[T0:%[0-9]+]] : @owned $@sil_unowned Builtin.NativeObject):
// CHECK-NEXT: [[COPY_RESULT:%.*]] = strong_copy_unowned_value [[T0]] : $@sil_unowned Builtin.NativeObject
// CHECK-NEXT: destroy_value [[T0]] : $@sil_unowned Builtin.NativeObject
// CHECK-NEXT: return [[COPY_RESULT]] : $Builtin.NativeObject
sil [ossa] @test_strong_copy_unowned_value : $@convention(thin) (@owned @sil_unowned Builtin.NativeObject) -> @owned Builtin.NativeObject {
bb0(%0 : @owned $@sil_unowned Builtin.NativeObject):
  %1 = strong_copy_unowned_value %0 : $@sil_unowned Builtin.NativeObject
  destroy_value %0 : $@sil_unowned Builtin.NativeObject
  return %1 : $Builtin.NativeObject
}

sil [ossa] @strong_copy_unmanaged_value_test : $@convention(thin) (@sil_unmanaged Builtin.NativeObject) -> @owned Builtin.NativeObject {
bb0(%0 : $@sil_unmanaged Builtin.NativeObject):
  %1 = strong_copy_unmanaged_value %0 : $@sil_unmanaged Builtin.NativeObject
  return %1 : $Builtin.NativeObject
}

// CHECK-LABEL: sil [ossa] @test_destroy_poison
// CHECK: bb0([[T0:%[0-9]+]] : @owned $Builtin.NativeObject):
// CHECK-NEXT: destroy_value [poison] [[T0]] : $Builtin.NativeObject
// CHECK-NEXT: tuple
// CHECK-NEXT: return
sil [ossa] @test_destroy_poison : $@convention(thin) (@owned Builtin.NativeObject) -> () {
bb0(%0 : @owned $Builtin.NativeObject):
  destroy_value [poison] %0 : $Builtin.NativeObject
  %2 = tuple ()
  return %2 : $()
}

// CHECK-LABEL: sil [ossa] @test_movevalue_parsing : $@convention(thin) (@owned Builtin.NativeObject) -> @owned Builtin.NativeObject {
// CHECK: bb0([[REGISTER_0:%[^,]+]] :
// CHECK-NEXT: [[REGISTER_1:%[^,]+]] = move_value [[REGISTER_0]]
// CHECK-NEXT: [[REGISTER_2:%[^,]+]] = move_value [allows_diagnostics] [[REGISTER_1]]
// CHECK-NEXT: [[REGISTER_3:%[^,]+]] = move_value [lexical] [[REGISTER_2]]
// CHECK-NEXT: [[REGISTER_4:%[^,]+]] = move_value [allows_diagnostics] [lexical] [[REGISTER_3]]
// CHECK-NEXT: [[REGISTER_5:%[^,]+]] = move_value [allows_diagnostics] [lexical] [[REGISTER_4]]
// CHECK-NEXT: [[REGISTER_6:%[^,]+]] = move_value [allows_diagnostics] [lexical] [pointer_escape] [[REGISTER_5]]
// CHECK-NEXT: [[REGISTER_7:%[^,]+]] = move_value [var_decl] [[REGISTER_6]]
// CHECK-NEXT: return [[REGISTER_7]]
// CHECK-NEXT: } // end sil function 'test_movevalue_parsing'
sil [ossa] @test_movevalue_parsing : $@convention(thin) (@owned Builtin.NativeObject) -> @owned Builtin.NativeObject {
bb0(%0 : @owned $Builtin.NativeObject):
  %1 = move_value %0 : $Builtin.NativeObject
  %2 = move_value [allows_diagnostics] %1 : $Builtin.NativeObject
  %3 = move_value [lexical] %2 : $Builtin.NativeObject
  %4 = move_value [allows_diagnostics] [lexical] %3 : $Builtin.NativeObject
  %5 = move_value [lexical] [allows_diagnostics] %4 : $Builtin.NativeObject
  %6 = move_value [pointer_escape] [lexical] [allows_diagnostics] %5 : $Builtin.NativeObject
  %7 = move_value [var_decl] %6 : $Builtin.NativeObject
  return %7 : $Builtin.NativeObject
}

// CHECK-LABEL: sil [ossa] @test_debug_value_alloc_stack_moved : $@convention(thin) (@owned Builtin.NativeObject) -> () {
// CHECK:  debug_value [moveable_value_debuginfo] %0 : $Builtin.NativeObject
// CHECK:  debug_value [poison] %0 : $Builtin.NativeObject
// CHECK:  debug_value [poison] [moveable_value_debuginfo] %0 : $Builtin.NativeObject
// CHECK:  debug_value [poison] [moveable_value_debuginfo] %0 : $Builtin.NativeObject
// CHECK:  alloc_stack [moveable_value_debuginfo] $Builtin.NativeObject
// CHECK: } // end sil function 'test_debug_value_alloc_stack_moved'
sil [ossa] @test_debug_value_alloc_stack_moved : $@convention(thin) (@owned Builtin.NativeObject) -> () {
bb0(%0 : @owned $Builtin.NativeObject):
  debug_value [moveable_value_debuginfo] %0 : $Builtin.NativeObject
  debug_value [poison] %0 : $Builtin.NativeObject
  debug_value [moveable_value_debuginfo] [poison] %0 : $Builtin.NativeObject
  debug_value [poison] [moveable_value_debuginfo] %0 : $Builtin.NativeObject

  %1 = alloc_stack [moveable_value_debuginfo] $Builtin.NativeObject
  dealloc_stack %1 : $*Builtin.NativeObject

  destroy_value %0 : $Builtin.NativeObject
  %9999 = tuple()
  return %9999 : $()
}

// Make sure that we properly can parse/print/round trip move only type annotation.
// CHECK-LABEL: sil [ossa] @test_moveonlytype_parsing : $@convention(thin) (@owned @moveOnly Builtin.NativeObject) -> () {
// CHECK: bb0(%0 : @owned $@moveOnly Builtin.NativeObject):
// CHECK-NEXT:   %1 = copy_value %0 : $@moveOnly Builtin.NativeObject
// CHECK-NEXT:   destroy_value %0 : $@moveOnly Builtin.NativeObject
// CHECK-NEXT:   destroy_value %1 : $@moveOnly Builtin.NativeObject
// CHECK: } // end sil function 'test_moveonlytype_parsing'
sil [ossa] @test_moveonlytype_parsing : $@convention(thin) (@owned @moveOnly Builtin.NativeObject) -> () {
bb0(%0 : @owned $@moveOnly Builtin.NativeObject):
  %1 = copy_value %0 : $@moveOnly Builtin.NativeObject
  destroy_value %0 : $@moveOnly Builtin.NativeObject
  destroy_value %1 : $@moveOnly Builtin.NativeObject
  %9999 = tuple()
  return %9999 : $()
}

// CHECK-LABEL: sil [ossa] @test_explicit_copy_addr : $@convention(thin) (@owned Builtin.NativeObject) -> () {
// CHECK: explicit_copy_addr %{{[0-9]+}} to [init] %{{[0-9]+}} :
// CHECK: explicit_copy_addr [take] %{{[0-9]+}} to [init] %{{[0-9]+}} :
// CHECK: explicit_copy_addr [take] %{{[0-9]+}} to %{{[0-9]+}} :
// CHECK: explicit_copy_addr %{{[0-9]+}} to %{{[0-9]+}} :
// CHECK: } // end sil function 'test_explicit_copy_addr'
sil [ossa] @test_explicit_copy_addr : $@convention(thin) (@owned Builtin.NativeObject) -> () {
bb0(%0 : @owned $Builtin.NativeObject):
  %1 = alloc_stack $Builtin.NativeObject
  %2 = alloc_stack $Builtin.NativeObject
  %3 = alloc_stack $Builtin.NativeObject

  %0a = copy_value %0 : $Builtin.NativeObject
  store %0a to [init] %1 : $*Builtin.NativeObject
  explicit_copy_addr %1 to [init] %2 : $*Builtin.NativeObject  
  explicit_copy_addr [take] %2 to [init] %3 : $*Builtin.NativeObject
  explicit_copy_addr [take] %3 to %1 : $*Builtin.NativeObject

  store %0 to [init] %2 : $*Builtin.NativeObject
  explicit_copy_addr %1 to %2 : $*Builtin.NativeObject

  destroy_addr %2 : $*Builtin.NativeObject
  destroy_addr %1 : $*Builtin.NativeObject
  dealloc_stack %3 : $*Builtin.NativeObject
  dealloc_stack %2 : $*Builtin.NativeObject
  dealloc_stack %1 : $*Builtin.NativeObject
  %9999 = tuple()
  return %9999 : $()
}

// CHECK-LABEL: sil [ossa] @test_allocbox_parsing : $@convention(thin) () -> () {
// CHECK: alloc_box [pointer_escape] [moveable_value_debuginfo] ${ var Builtin.NativeObject }
// CHECK: } // end sil function 'test_allocbox_parsing'
sil [ossa] @test_allocbox_parsing : $@convention(thin) () -> () {
bb0:
  %0 = alloc_box [moveable_value_debuginfo] [pointer_escape] ${ var Builtin.NativeObject }
  dealloc_box %0 : ${ var Builtin.NativeObject }
  %9999 = tuple()
  return %9999 : $()
}

// CHECK-LABEL: sil [ossa] @test_beginborrow_parsing :
// CHECK:   %1 = begin_borrow [pointer_escape] %0 : $Builtin.NativeObject
// CHECK-LABEL: } // end sil function 'test_beginborrow_parsing'
sil [ossa] @test_beginborrow_parsing : $@convention(thin) (@owned Builtin.NativeObject) -> () {
bb0(%0 : @owned $Builtin.NativeObject):
  %1 = begin_borrow [pointer_escape] %0 : $Builtin.NativeObject
  %2 = unchecked_bitwise_cast %1 : $Builtin.NativeObject to $Builtin.Int64
  end_borrow %1 : $Builtin.NativeObject
  destroy_value %0 : $Builtin.NativeObject
  %t = tuple ()
  return %t : $()
}

// CHECK-LABEL: sil [ossa] @test_escapingarg_parsing :
// CHECK: bb1(%2 : @pointer_escape @owned $Builtin.NativeObject):
// CHECK-LABEL: } // end sil function 'test_escapingarg_parsing'
sil [ossa] @test_escapingarg_parsing : $@convention(thin) (@owned Builtin.NativeObject) -> () {
bb0(%0 : @owned $Builtin.NativeObject):
  br bb1(%0 : $Builtin.NativeObject)

bb1(%2 : @pointer_escape @owned $Builtin.NativeObject):
  destroy_value %2 : $Builtin.NativeObject
  %t = tuple ()
  return %t : $()
}

// CHECK-LABEL: sil [ossa] @test_copyable_to_moveonlywrapper : $@convention(thin) (@owned Builtin.NativeObject) -> () {
// CHECK: copyable_to_moveonlywrapper
// CHECK: } // end sil function 'test_copyable_to_moveonlywrapper'
sil [ossa] @test_copyable_to_moveonlywrapper : $@convention(thin) (@owned Builtin.NativeObject) -> () {
bb0(%0 : @owned $Builtin.NativeObject):
  %0a = copyable_to_moveonlywrapper [owned] %0 : $Builtin.NativeObject
  destroy_value %0a : $@moveOnly Builtin.NativeObject
  %9999 = tuple()
  return %9999 : $()
}

// CHECK-LABEL: sil [ossa] @test_moveonlywrapper_to_copyable_addr : $@convention(thin) (@in Builtin.NativeObject) -> () {
// CHECK: moveonlywrapper_to_copyable_addr
// CHECK: } // end sil function 'test_moveonlywrapper_to_copyable_addr'
sil [ossa] @test_moveonlywrapper_to_copyable_addr : $@convention(thin) (@in Builtin.NativeObject) -> () {
bb0(%0 : $*Builtin.NativeObject):
  %1 = alloc_stack $@moveOnly Builtin.NativeObject
  %1a = moveonlywrapper_to_copyable_addr %1 : $*@moveOnly Builtin.NativeObject
  copy_addr [take] %0 to [init] %1a : $*Builtin.NativeObject
  destroy_addr %1 : $*@moveOnly Builtin.NativeObject
  dealloc_stack %1 : $*@moveOnly Builtin.NativeObject
  %9999 = tuple()
  return %9999 : $()
}

// CHECK-LABEL: sil [ossa] @test_copyable_to_moveonlywrapper_addr : $@convention(thin) (@in Builtin.NativeObject) -> () {
// CHECK: copyable_to_moveonlywrapper_addr
// CHECK: } // end sil function 'test_copyable_to_moveonlywrapper_addr'
sil [ossa] @test_copyable_to_moveonlywrapper_addr : $@convention(thin) (@in Builtin.NativeObject) -> () {
bb0(%0 : $*Builtin.NativeObject):
  %0a = copyable_to_moveonlywrapper_addr %0 : $*Builtin.NativeObject
  destroy_addr %0a : $*@moveOnly Builtin.NativeObject
  %9999 = tuple()
  return %9999 : $()
}

// CHECK-LABEL: sil [ossa] @test_moveonlywrapper_to_copyable_box : $@convention(thin) () -> () {
// CHECK: [[BOX:%.*]] = alloc_box ${ var @moveOnly Builtin.NativeObject }
// CHECK: [[CAST:%.*]] = moveonlywrapper_to_copyable_box [[BOX]] : ${ var @moveOnly Builtin.NativeObject }
// CHECK: dealloc_box [[CAST]] : ${ var Builtin.NativeObject }
// CHECK: } // end sil function 'test_moveonlywrapper_to_copyable_box'
sil [ossa] @test_moveonlywrapper_to_copyable_box : $@convention(thin) () -> () {
bb0:
  %0 = alloc_box ${ var @moveOnly Builtin.NativeObject }
  %1 = moveonlywrapper_to_copyable_box %0 : ${ var @moveOnly Builtin.NativeObject }
  dealloc_box %1 : ${ var Builtin.NativeObject }
  %9999 = tuple ()
  return %9999 : $()
}

// CHECK-LABEL: sil [ossa] @tuple_addr_constructor_assign : $@convention(thin) (@in Builtin.NativeObject, @in (Builtin.NativeObject, Builtin.NativeObject)) -> () {
// CHECK: bb0([[LHS:%.*]] : $*Builtin.NativeObject,
// CHECK: [[RHS:%.*]] = alloc_stack $Builtin.NativeObject
// CHECK: [[DEST:%.*]] = alloc_stack $(Builtin.NativeObject, Builtin.NativeObject)
// CHECK: tuple_addr_constructor [assign] [[DEST]] : $*(Builtin.NativeObject, Builtin.NativeObject) with ([[LHS]] : $*Builtin.NativeObject, [[RHS]] : $*Builtin.NativeObject)
// CHECK: } // end sil function 'tuple_addr_constructor_assign'
sil [ossa] @tuple_addr_constructor_assign : $@convention(thin) (@in Builtin.NativeObject, @in (Builtin.NativeObject, Builtin.NativeObject)) -> () {
bb0(%0 : $*Builtin.NativeObject, %0a : $*(Builtin.NativeObject, Builtin.NativeObject)):
  %1 = alloc_stack $Builtin.NativeObject
  copy_addr %0 to [init] %1 : $*Builtin.NativeObject
  %2 = alloc_stack $(Builtin.NativeObject, Builtin.NativeObject)
  copy_addr [take] %0a to [init] %2 : $*(Builtin.NativeObject, Builtin.NativeObject)
  tuple_addr_constructor [assign] %2 : $*(Builtin.NativeObject, Builtin.NativeObject) with (%0 : $*Builtin.NativeObject, %1 : $*Builtin.NativeObject)
  destroy_addr %2 : $*(Builtin.NativeObject, Builtin.NativeObject)
  dealloc_stack %2 : $*(Builtin.NativeObject, Builtin.NativeObject)
  dealloc_stack %1 : $*Builtin.NativeObject
  %9999 = tuple ()
  return %9999 : $()
}

// CHECK-LABEL: sil [ossa] @tuple_addr_constructor_init : $@convention(thin) (@in Builtin.NativeObject) -> () {
// CHECK: bb0([[LHS:%.*]] : $*
// CHECK: [[RHS:%.*]] = alloc_stack $Builtin.NativeObject
// CHECK: [[DEST:%.*]] = alloc_stack $(Builtin.NativeObject, Builtin.NativeObject)
// CHECK: tuple_addr_constructor [init] [[DEST]] : $*(Builtin.NativeObject, Builtin.NativeObject) with ([[LHS]] : $*Builtin.NativeObject, [[RHS]] : $*Builtin.NativeObject)
// CHECK: } // end sil function 'tuple_addr_constructor_init'
sil [ossa] @tuple_addr_constructor_init : $@convention(thin) (@in Builtin.NativeObject) -> () {
bb0(%0 : $*Builtin.NativeObject):
  %1 = alloc_stack $Builtin.NativeObject
  copy_addr %0 to [init] %1 : $*Builtin.NativeObject
  %2 = alloc_stack $(Builtin.NativeObject, Builtin.NativeObject)
  tuple_addr_constructor [init] %2 : $*(Builtin.NativeObject, Builtin.NativeObject) with (%0 : $*Builtin.NativeObject, %1 : $*Builtin.NativeObject)
  destroy_addr %2 : $*(Builtin.NativeObject, Builtin.NativeObject)
  dealloc_stack %2 : $*(Builtin.NativeObject, Builtin.NativeObject)
  dealloc_stack %1 : $*Builtin.NativeObject
  %9999 = tuple ()
  return %9999 : $()
}

// CHECK-LABEL: sil [ossa] @tuple_addr_constructor_differing_category : $@convention(thin) (@in Builtin.NativeObject, @owned Builtin.NativeObject) -> () {
// CHECK: bb0([[LHS:%.*]] : $*Builtin.NativeObject, [[RHS:%.*]] : @owned $Builtin.NativeObject)
// CHECK: [[DEST:%.*]] = alloc_stack $(Builtin.NativeObject, Builtin.NativeObject)
// CHECK: tuple_addr_constructor [init] [[DEST]] : $*(Builtin.NativeObject, Builtin.NativeObject) with ([[LHS]] : $*Builtin.NativeObject, [[RHS]] : $Builtin.NativeObject)
// CHECK: } // end sil function 'tuple_addr_constructor_differing_category'
sil [ossa] @tuple_addr_constructor_differing_category : $@convention(thin) (@in Builtin.NativeObject, @owned Builtin.NativeObject) -> () {
bb0(%0 : $*Builtin.NativeObject, %1 : @owned $Builtin.NativeObject):
  %2 = alloc_stack $(Builtin.NativeObject, Builtin.NativeObject)
  tuple_addr_constructor [init] %2 : $*(Builtin.NativeObject, Builtin.NativeObject) with (%0 : $*Builtin.NativeObject, %1 : $Builtin.NativeObject)
  destroy_addr %2 : $*(Builtin.NativeObject, Builtin.NativeObject)
  dealloc_stack %2 : $*(Builtin.NativeObject, Builtin.NativeObject)
  %9999 = tuple ()
  return %9999 : $()
}

// CHECK-LABEL: sil [ossa] @tuple_addr_constructor_unfriendly_tuple : $@convention(thin) (@in Builtin.NativeObject, @owned Builtin.NativeObject) -> () {
// CHECK: tuple_addr_constructor [init] {{%.*}} : $*((), (Builtin.NativeObject, Builtin.NativeObject)) with
sil [ossa] @tuple_addr_constructor_unfriendly_tuple : $@convention(thin) (@in Builtin.NativeObject, @owned Builtin.NativeObject) -> () {
bb0(%0 : $*Builtin.NativeObject, %1 : @owned $Builtin.NativeObject):
  %2 = alloc_stack $((), (Builtin.NativeObject, Builtin.NativeObject))
  tuple_addr_constructor [init] %2 : $*((), (Builtin.NativeObject, Builtin.NativeObject)) with (%0 : $*Builtin.NativeObject, %1 : $Builtin.NativeObject)
  destroy_addr %2 : $*((), (Builtin.NativeObject, Builtin.NativeObject))
  dealloc_stack %2 : $*((), (Builtin.NativeObject, Builtin.NativeObject))
  %9999 = tuple ()
  return %9999 : $()
}

// CHECK-LABEL: sil [ossa] @test_mark_dependence : $@convention(thin) (@owned Builtin.NativeObject, @owned Builtin.NativeObject) -> () {
// CHECK: [[MD1:%.*]] = mark_dependence %1 : $Builtin.NativeObject on %0 : $Builtin.NativeObject
// CHECK: [[MD2:%.*]] = mark_dependence [nonescaping] [[MD1]] : $Builtin.NativeObject on %0 : $Builtin.NativeObject
// CHECK: mark_dependence [unresolved] [[MD2]] : $Builtin.NativeObject on %0 : $Builtin.NativeObject
// CHECK: } // end sil function 'test_mark_dependence'
sil [ossa] @test_mark_dependence : $@convention(thin) (@owned Builtin.NativeObject, @owned Builtin.NativeObject) -> () {
bb0(%0 : @owned $Builtin.NativeObject, %1 : @owned $Builtin.NativeObject):
  %md1 = mark_dependence %1 : $Builtin.NativeObject on %0 : $Builtin.NativeObject
  %md2 = mark_dependence [nonescaping] %md1 : $Builtin.NativeObject on %0 : $Builtin.NativeObject
  %md3 = mark_dependence [unresolved] %md2 : $Builtin.NativeObject on %0 : $Builtin.NativeObject
  destroy_value %md3 : $Builtin.NativeObject
  destroy_value %0 : $Builtin.NativeObject
  %9999 = tuple()
  return %9999 : $()
}

// CHECK-LABEL: sil [ossa] @testMarkUnresolvedNonCopyableValueInst : $@convention(thin) (@guaranteed Klass) -> () {
// CHECK: mark_unresolved_non_copyable_value [consumable_and_assignable] %{{[0-9]+}} : $*MoveOnlyPair
// CHECK: } // end sil function 'testMarkUnresolvedNonCopyableValueInst'
sil [ossa] @testMarkUnresolvedNonCopyableValueInst : $@convention(thin) (@guaranteed Klass) -> () {
bb0(%0 : @guaranteed $Klass):
  %1 = alloc_box ${ var MoveOnlyPair }
  %2 = project_box %1 : ${ var MoveOnlyPair }, 0
  %3 = mark_unresolved_non_copyable_value [consumable_and_assignable] %2 : $*MoveOnlyPair
  %3c = begin_access [modify] [static] %3 : $*MoveOnlyPair
  %3a = struct_element_addr %3c : $*MoveOnlyPair, #MoveOnlyPair.lhs
  %3b = struct_element_addr %3c : $*MoveOnlyPair, #MoveOnlyPair.rhs
  %0a = copy_value %0 : $Klass
  %0b = copy_value %0 : $Klass
  store %0a to [init] %3a : $*Klass
  store %0b to [init] %3b : $*Klass
  end_access %3c : $*MoveOnlyPair

  destroy_value %1 : ${ var MoveOnlyPair }

  %9999 = tuple()
  return %9999 : $()
}

// CHECK-LABEL: sil [ossa] @test_extend_lifetime : {{.*}} {
// CHECK:       bb0([[K:%[^,]+]] :
// CHECK:         br [[LOOP:bb[0-9]+]]
// CHECK:       [[LOOP]]:
// CHECK:         extend_lifetime [[K]]
// CHECK:         br [[LOOP]]
// CHECK-LABEL: } // end sil function 'test_extend_lifetime'
sil [ossa] @test_extend_lifetime : $@convention(thin) (@owned Klass) -> () {
entry(%k : @owned $Klass):
  br bb1
bb1:
  extend_lifetime %k : $Klass
  br bb1
}

// CHECK-LABEL: sil [ossa] @test_destroy_value : {{.*}} {
// CHECK:         destroy_value
// CHECK:         destroy_value [poison]
// CHECK:         destroy_value [dead_end]
// CHECK:         destroy_value [poison] [dead_end]
// CHECK-LABEL: } // end sil function 'test_destroy_value'
sil [ossa] @test_destroy_value : $@convention(thin) () -> () {
entry:
  %getKlass = function_ref @getKlass : $@convention(thin) () -> (@owned Klass)
  cond_br undef, good, bad

good:
  cond_br undef, gleft, gright
gleft:
  %k1 = apply %getKlass() : $@convention(thin) () -> (@owned Klass)
  destroy_value %k1 : $Klass
  br exit
gright:
  %k2 = apply %getKlass() : $@convention(thin) () -> (@owned Klass)
  destroy_value [poison] %k2 : $Klass
  br exit
exit:
  %retval = tuple()
  return %retval : $()
bad:
  cond_br undef, bleft, bright
bleft:
  %k3 = apply %getKlass() : $@convention(thin) () -> (@owned Klass)
  destroy_value [dead_end] %k3 : $Klass
  unreachable
bright:
  %k4 = apply %getKlass() : $@convention(thin) () -> (@owned Klass)
  destroy_value [poison] [dead_end] %k4 : $Klass
  unreachable
}

// CHECK-LABEL: sil [ossa] @test_dealloc_box : {{.*}} {
// CHECK:         dealloc_box
// CHECK:         dealloc_box [dead_end]
// CHECK-LABEL: } // end sil function 'test_dealloc_box'
sil [ossa] @test_dealloc_box : $@convention(thin) () -> () {
entry:
  %b = alloc_box ${ var Klass }
  cond_br undef, exit, die

exit:
  dealloc_box %b : ${ var Klass }
  %retval = tuple()
  return %retval : $()

die:
  dealloc_box [dead_end] %b : ${ var Klass }
  unreachable
}

// CHECK-LABEL: sil [ossa] @test_type_value : $@convention(thin) <let N : Int> () -> Int {
// CHECK:         type_value $Int for N
// CHECK-LABEL: } // end sil function 'test_type_value
sil [ossa] @test_type_value : $@convention(thin) <let N : Int> () -> Int {
entry:
  %val = type_value $Int for N
  return %val : $Int
}

// CHECK-LABEL: sil @thunk_inst : $@convention(thin) () -> () {
// CHECK:  [[FUNC:%[0-9]+]] = function_ref @getKlass : $@convention(thin) () -> @owned Klass
// CHECK:  %{{.*}} = thunk [identity] [[FUNC]]() : $@convention(thin) () -> @owned Klass
// CHECK: } // end sil function 'thunk_inst'
sil @thunk_inst : $@convention(thin) () -> () {
bb0:
  %0 = function_ref @getKlass : $@convention(thin) () -> (@owned Klass)
  %1 = thunk [identity] %0() : $@convention(thin) () -> @owned Klass
  %9999 = tuple ()
  return %9999 : $()
}

// CHECK-LABEL: sil [ossa] @thunk_inst_ossa : $@convention(thin) () -> () {
// CHECK:  [[FUNC:%[0-9]+]] = function_ref @getKlass : $@convention(thin) () -> @owned Klass
// CHECK:  %{{.*}} = thunk [identity] [[FUNC]]() : $@convention(thin) () -> @owned Klass
// CHECK: } // end sil function 'thunk_inst_ossa'
sil [ossa] @thunk_inst_ossa : $@convention(thin) () -> () {
bb0:
  %0 = function_ref @getKlass : $@convention(thin) () -> @owned Klass
  %1 = thunk [identity] %0() : $@convention(thin) () -> @owned Klass
  destroy_value %1 : $@callee_guaranteed () -> @owned Klass
  %9999 = tuple ()
  return %9999 : $()
}

sil @generic_func : $@convention(thin) <T> (@in T) -> ()

// CHECK-LABEL: sil [ossa] @thunk_inst_ossa_generic : $@convention(thin) () -> () {
// CHECK:  [[FUNC:%[0-9]+]] = function_ref @generic_func : $@convention(thin) <τ_0_0> (@in τ_0_0) -> ()
// CHECK:  {{%.*}} = thunk [identity] [[FUNC]]<Klass>() : $@convention(thin) <τ_0_0> (@in τ_0_0) -> ()
// CHECK: } // end sil function 'thunk_inst_ossa_generic'
sil [ossa] @thunk_inst_ossa_generic : $@convention(thin) () -> () {
bb0:
  %0 = function_ref @generic_func : $@convention(thin) <T> (@in T) -> ()
  %1 = thunk [identity] %0<Klass>() : $@convention(thin) <T> (@in T) -> ()
  destroy_value %1 : $@callee_guaranteed (@in Klass) -> ()
  %9999 = tuple ()
  return %9999 : $()
}

// CHECK-LABEL: sil [ossa] @merge_isolation_region : $@convention(thin) (@guaranteed Klass) -> () {
// CHECK: merge_isolation_region %0 : $Klass, %1 : $*MoveOnlyPair
// CHECK: merge_isolation_region %1 : $*MoveOnlyPair, %0 : $Klass, %0 : $Klass
// CHECK: } // end sil function 'merge_isolation_region'
sil [ossa] @merge_isolation_region : $@convention(thin) (@guaranteed Klass) -> () {
bb0(%0 : @guaranteed $Klass):
  %1 = alloc_stack $MoveOnlyPair
  merge_isolation_region %0 : $Klass, %1 : $*MoveOnlyPair
  merge_isolation_region %1 : $*MoveOnlyPair, %0 : $Klass, %0 : $Klass
  dealloc_stack %1 : $*MoveOnlyPair
  %9999 = tuple ()
  return %9999 : $()
}