File: dead_code_elimination_ossa.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 (490 lines) | stat: -rw-r--r-- 16,356 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
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
// RUN: %target-sil-opt -enable-sil-verify-all -dce %s | %FileCheck %s

sil_stage canonical

import Builtin
import Swift

public struct S {
  var o: AnyObject
}

typealias Int1 = Builtin.Int1

class C {}

sil @getC : $@convention(thin) () -> @owned C
sil @barrier : $@convention(thin) () -> ()

struct CAndBit {
    var c: C
    var bit: Int1
}

@_moveOnly
struct MO {
    deinit
}

sil @dummy : $@convention(thin) () -> ()

// CHECK-LABEL: sil [ossa] @dead1 :
// CHECK: bb0
// CHECK-NEXT: return %0
// CHECK-LABEL: } // end sil function 'dead1'
sil [ossa] @dead1 : $@convention(thin) (Int32, Int32) -> Int32 {
bb0(%0 : $Int32, %1 : $Int32):
  %3 = struct_extract %0 : $Int32, #Int32._value
  %4 = struct_extract %1 : $Int32, #Int32._value
  %5 = integer_literal $Builtin.Int1, -1
  %6 = builtin "sadd_with_overflow_Int32"(%3 : $Builtin.Int32, %4 : $Builtin.Int32, %5 : $Builtin.Int1) : $(Builtin.Int32, Builtin.Int1)
  %7 = tuple_extract %6 : $(Builtin.Int32, Builtin.Int1), 0
  %8 = struct $Int32 (%7 : $Builtin.Int32)
  return %0 : $Int32
}

// CHECK-LABEL: sil [ossa] @dead2 :
sil [ossa] @dead2 : $@convention(thin) () -> () {
bb0:
  %0 = integer_literal $Builtin.Int32, 2
  %1 = integer_literal $Builtin.Int32, 0
  br bb1(%0 : $Builtin.Int32, %1 : $Builtin.Int32)

bb1(%3 : $Builtin.Int32, %4 : $Builtin.Int32):
  %5 = integer_literal $Builtin.Int32, 100
  %7 = builtin "cmp_slt_Int32"(%4 : $Builtin.Int32, %5 : $Builtin.Int32) : $Builtin.Int1
  cond_br %7, bb2, bb3

bb2:
  %9 = integer_literal $Builtin.Int32, 3
  %11 = integer_literal $Builtin.Int1, -1
  %12 = builtin "sadd_with_overflow_Int32"(%3 : $Builtin.Int32, %9 : $Builtin.Int32, %11 : $Builtin.Int1) : $(Builtin.Int32, Builtin.Int1)
  %13 = tuple_extract %12 : $(Builtin.Int32, Builtin.Int1), 0
  %14 = integer_literal $Builtin.Int32, 1
  %15 = builtin "sadd_with_overflow_Int32"(%4 : $Builtin.Int32, %14 : $Builtin.Int32, %11 : $Builtin.Int1) : $(Builtin.Int32, Builtin.Int1)
  %16 = tuple_extract %15 : $(Builtin.Int32, Builtin.Int1), 0
  br bb1(%13 : $Builtin.Int32, %16 : $Builtin.Int32)

bb3:
  %18 = tuple ()
  return %18 : $()
}
// CHECK-LABEL: } // end sil function 'dead2'

// CHECK-LABEL: sil [ossa] @dead3 :
sil [ossa] @dead3 : $@convention(thin) () -> () {
bb0:
// CHECK: bb0
  br bb1
// CHECK: bb1
bb1:
// CHECK:      bb1:
// CHECK-NEXT:   br bb1
  %0 = integer_literal $Builtin.Int32, 0
  br bb1
}
// CHECK-LABEL: } // end sil function 'dead3'

// CHECK-LABEL: sil [ossa] @test_dce_bbargs :
sil [ossa] @test_dce_bbargs : $@convention(thin) () -> () {
bb0:
  %0 = integer_literal $Builtin.Int32, 0
  %1 = struct $Int32 (%0 : $Builtin.Int32)
  %2 = integer_literal $Builtin.Int32, 0
  %3 = struct $Int32 (%2 : $Builtin.Int32)
  %4 = integer_literal $Builtin.Int32, 0
  %5 = struct $Int32 (%4 : $Builtin.Int32)
  %6 = integer_literal $Builtin.Int32, 0
  %7 = struct $Int32 (%6 : $Builtin.Int32)
  %8 = integer_literal $Builtin.Int32, 0
  %9 = struct $Int32 (%8 : $Builtin.Int32)
  %10 = integer_literal $Builtin.Int32, 0
  %11 = struct $Int32 (%10 : $Builtin.Int32)
  br bb1(%1 : $Int32, %3 : $Int32, %11 : $Int32, %7 : $Int32, %9 : $Int32)

bb1(%13 : $Int32, %14 : $Int32, %15 : $Int32, %16 : $Int32, %17 : $Int32):
  %18 = integer_literal $Builtin.Int32, 11
  %20 = struct_extract %15 : $Int32, #Int32._value
  %21 = builtin "cmp_slt_Int32"(%20 : $Builtin.Int32, %18 : $Builtin.Int32) : $Builtin.Int1
  %22 = struct $Bool (%21 : $Builtin.Int1)
  %23 = struct_extract %22 : $Bool, #Bool._value
  cond_br %23, bb2, bb12

// CHECK: bb2:
bb2:
  %25 = integer_literal $Builtin.Int32, 0
  %26 = struct $Int32 (%25 : $Builtin.Int32)
  br bb3(%13 : $Int32, %14 : $Int32, %26 : $Int32, %17 : $Int32)

bb3(%28 : $Int32, %29 : $Int32, %30 : $Int32, %31 : $Int32):
  %32 = integer_literal $Builtin.Int32, 22
  %34 = struct_extract %30 : $Int32, #Int32._value
  %35 = builtin "cmp_slt_Int32"(%34 : $Builtin.Int32, %32 : $Builtin.Int32) : $Builtin.Int1
  %36 = struct $Bool (%35 : $Builtin.Int1)
  %37 = struct_extract %36 : $Bool, #Bool._value
  cond_br %37, bb4, bb11

// CHECK: bb4:
bb4:
  %39 = integer_literal $Builtin.Int32, 0
  %41 = struct_extract %28 : $Int32, #Int32._value
  %42 = builtin "cmp_eq_Int32"(%39 : $Builtin.Int32, %41 : $Builtin.Int32) : $Builtin.Int1
  %43 = struct $Bool (%42 : $Builtin.Int1)
  %44 = struct_extract %43 : $Bool, #Bool._value
// CHECK-NOT: cond_br
// CHECK: br bb5
  cond_br %44, bb5, bb6

bb5:
  %46 = integer_literal $Builtin.Int32, 0
  %47 = struct $Int32 (%46 : $Builtin.Int32)
  br bb7(%47 : $Int32)

bb6:
 br bb7(%28 : $Int32)

bb7(%49 : $Int32):
  %50 = integer_literal $Builtin.Int32, 10
  %52 = struct_extract %29 : $Int32, #Int32._value
  %53 = builtin "cmp_eq_Int32"(%50 : $Builtin.Int32, %52 : $Builtin.Int32) : $Builtin.Int1
  %54 = struct $Bool (%53 : $Builtin.Int1)
  %55 = struct_extract %54 : $Bool, #Bool._value
  cond_br %55, bb8, bb9

bb8:
  %57 = integer_literal $Builtin.Int32, 0
  %58 = struct $Int32 (%57 : $Builtin.Int32)
  br bb10(%58 : $Int32)

bb9:
  br bb10(%29 : $Int32)

// CHECK: bb5([[BBARG:%.*]]):
bb10(%60 : $Int32):
  %61 = struct_extract %31 : $Int32, #Int32._value
  %62 = integer_literal $Builtin.Int32, 1
  %64 = integer_literal $Builtin.Int1, -1
// CHECK-NOT: builtin "sadd_with_overflow_Int32"
// CHECK-NOT: cond_fail
  %65 = builtin "sadd_with_overflow_Int32"(%61 : $Builtin.Int32, %62 : $Builtin.Int32, %64 : $Builtin.Int1) : $(Builtin.Int32, Builtin.Int1)
  %66 = tuple_extract %65 : $(Builtin.Int32, Builtin.Int1), 0
  %67 = tuple_extract %65 : $(Builtin.Int32, Builtin.Int1), 1
  cond_fail %67 : $Builtin.Int1
  %69 = struct $Int32 (%66 : $Builtin.Int32)
  %70 = struct_extract %30 : $Int32, #Int32._value
  %71 = integer_literal $Builtin.Int32, 1
  %73 = integer_literal $Builtin.Int1, -1
// CHECK: builtin "ssub_with_overflow_Int32"
  %74 = builtin "ssub_with_overflow_Int32"(%70 : $Builtin.Int32, %71 : $Builtin.Int32, %73 : $Builtin.Int1) : $(Builtin.Int32, Builtin.Int1)
  %75 = tuple_extract %74 : $(Builtin.Int32, Builtin.Int1), 0
  %76 = tuple_extract %74 : $(Builtin.Int32, Builtin.Int1), 1
// CHECK: cond_fail
  cond_fail %76 : $Builtin.Int1
  %78 = struct $Int32 (%75 : $Builtin.Int32)
  %tif = function_ref @take_int32 : $@convention(thin) (Int32) -> ()
  %atif = apply %tif(%78) : $@convention(thin) (Int32) -> ()
// CHECK: br bb3
  br bb3(%49 : $Int32, %60 : $Int32, %78 : $Int32, %69 : $Int32)

// CHECK: bb6:
bb11:
  %80 = struct_extract %15 : $Int32, #Int32._value
  %81 = integer_literal $Builtin.Int32, 1
  %83 = integer_literal $Builtin.Int1, -1
  %84 = builtin "sadd_with_overflow_Int32"(%80 : $Builtin.Int32, %81 : $Builtin.Int32, %83 : $Builtin.Int1) : $(Builtin.Int32, Builtin.Int1)
  %85 = tuple_extract %84 : $(Builtin.Int32, Builtin.Int1), 0
  %86 = tuple_extract %84 : $(Builtin.Int32, Builtin.Int1), 1
  cond_fail %86 : $Builtin.Int1
  %88 = struct $Int32 (%85 : $Builtin.Int32)
// CHECK: br bb1
  br bb1(%28 : $Int32, %29 : $Int32, %88 : $Int32, %30 : $Int32, %31 : $Int32)

// CHECK: bb7:
bb12:
  %90 = tuple ()
// CHECK: return
  return %90 : $()
}
// CHECK-LABEL: } // end sil function 'test_dce_bbargs'

sil [ossa] @take_int32 : $@convention(thin) (Int32) -> ()

// CHECK-LABEL: sil [ossa] @remove_fix_lifetime :
// CHECK: bb0:
// CHECK-NEXT: tuple
// CHECK-NEXT: return
// CHECK-LABEL: } // end sil function 'remove_fix_lifetime'
sil [ossa] @remove_fix_lifetime : $@convention(thin) () -> () {
bb0:
  %0 = integer_literal $Builtin.Int32, 0
  %1 = struct $Int32 (%0 : $Builtin.Int32)

  fix_lifetime %1 : $Int32
  fix_lifetime %1 : $Int32

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

// CHECK-LABEL: sil [ossa] @dont_remove_fix_lifetime :
// CHECK: fix_lifetime
// CHECK: fix_lifetime
// CHECK: return
// CHECK-LABEL: } // end sil function 'dont_remove_fix_lifetime'
sil [ossa] @dont_remove_fix_lifetime : $@convention(thin) () -> Int32 {
bb0:
  %0 = integer_literal $Builtin.Int32, 0
  %1 = struct $Int32 (%0 : $Builtin.Int32)

  fix_lifetime %1 : $Int32
  fix_lifetime %1 : $Int32

  return %1 : $Int32
}

struct Container {
	var i: Int32
}

// CHECK-LABEL: sil [ossa] @dont_remove_addr_fix_lifetime :
// CHECK: fix_lifetime
// CHECK: fix_lifetime
// CHECK: return
// CHECK-LABEL: } // end sil function 'dont_remove_addr_fix_lifetime'
sil [ossa] @dont_remove_addr_fix_lifetime : $@convention(thin) (@in Container) -> () {
bb0(%0 : $*Container):
  %1 = struct_element_addr %0 : $*Container, #Container.i

  fix_lifetime %1 : $*Int32
  fix_lifetime %1 : $*Int32

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

// Check that DCE does not crash with an infinite loop through a cond_br.
// CHECK-LABEL: sil [ossa] @deal_with_infinite_loop :
// CHECK: cond_br
// CHECK-LABEL: } // end sil function 'deal_with_infinite_loop'
sil [ossa] @deal_with_infinite_loop : $@convention(thin) () -> () {
bb0:
  br bb1

bb1:
  cond_br undef, bb2, bb3

bb2:
  br bb1

bb3:
  br bb1
}

// Check that DCE eliminates dead access instructions.
// CHECK-LABEL: sil [ossa] @dead_access :
// CHECK: bb0
// CHECK-NEXT: tuple
// CHECK-NEXT: return
// CHECK-LABEL: } // end sil function 'dead_access'
sil [ossa] @dead_access : $@convention(thin) (@in Container) -> () {
bb0(%0 : $*Container):
  %1 = begin_access [modify] [dynamic] %0 : $*Container
  end_access %1 : $*Container

  %3 = begin_access [read] [static] %0 : $*Container
  end_access %3 : $*Container

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

// CHECK-LABEL: sil [ossa] @nested_destructure_tuple :
// CHECK:      bb0(%0 : @owned $(String, (Int, Int, String))):
// CHECK-NEXT:   (%1, %2) = destructure_tuple %0 : $(String, (Int, Int, String))
// CHECK-NEXT:   destroy_value %2
// CHECK-NEXT:   return %1
// CHECK:      } // end sil function 'nested_destructure_tuple'
sil [ossa] @nested_destructure_tuple : $@convention(thin) (@owned (String, (Int, Int, String))) -> @owned String {
bb0(%0 : @owned $(String, (Int, Int, String))):
  (%1, %2) = destructure_tuple %0 : $(String, (Int, Int, String))
  (%3, %4, %5) = destructure_tuple %2 : $(Int, Int, String)
  destroy_value %5 : $String
  return %1 : $String
}

// Test fix_lifetime of a struct and tuple. It cannot be removed
// without proving reference uniqueness first.
// rdar://36038096
// https://github.com/apple/swift/issues/49158
//
// CHECK-LABEL: @testFixLifetimeTuple : $@convention(thin) (@owned S, @owned AnyObject) -> () {
// CHECK: bb0(%0 : $S, %1 : $AnyObject):
// CHECK:   [[TUPLE:%.*]] = tuple (%0 : $S, %1 : $AnyObject)
// CHECK:   apply
// CHECK:   fix_lifetime [[TUPLE]] : $(S, AnyObject)
// CHECK:   strong_release %1 : $AnyObject
// CHECK:   strong_release %{{.*}} : $AnyObject
// CHECK-LABEL: } // end sil function 'testFixLifetimeTuple'
sil @testFixLifetimeTuple : $@convention(thin) (@owned S, @owned AnyObject) -> () {
bb0(%0 : $S, %1 : $AnyObject):
  %4 = struct_extract %0 : $S, #S.o
  %7 = tuple (%0 : $S, %1 : $AnyObject)
  %8 = function_ref @dummy : $@convention(thin) () -> ()
  %9 = apply %8() : $@convention(thin) () -> ()
  fix_lifetime %7 : $(S, AnyObject)
  strong_release %1 : $AnyObject
  strong_release %4 : $AnyObject
  %15 = tuple ()
  return %15 : $()
}

// Test fix_lifetime of a load_borrow. It cannot be removed without
// proving reference uniqueness first.
// rdar://74759728 (The compiler/optimizer seems to be shortening the lifetime too early)
//
// Test case derived from $defer #1 <A><A1>() in _ArrayBuffer.withUnsafeBufferPointer<A>(_:)
//
// Original source that exposed the issue with -Ounchecked -sanitize=address:
//
// public func makeRawData(name: String) -> UnsafeMutableRawPointer {
//   var array: [UInt8] = []
//   array.append(contentsOf: name.utf8)
//   array.append(0)
//
//   let rawData = array.withUnsafeBytes { (buffer: UnsafeRawBufferPointer) -> UnsafeMutableRawPointer in
//     let rawData = malloc(Int(buffer.count))!
//     rawData.copyMemory(from: buffer.baseAddress!, byteCount: buffer.count)
//     return rawData
//   }
//   return rawData
// }
//
// CHECK-LABEL: sil [ossa] @testDCEFixLifetime : $@convention(thin) (@guaranteed S) -> () {
// %0 "self"                                      // users: %3, %1
// CHECK: bb0(%0 : @guaranteed $S):
// CHECK:   [[LD:%.*]] = load_borrow
// CHECK:   fix_lifetime [[LD]] : $S
// CHECK:   end_borrow [[LD]] : $S
// CHECK-LABEL: } // end sil function 'testDCEFixLifetime'
sil [ossa] @testDCEFixLifetime : $@convention(thin) (@guaranteed S) -> () {
// %0 "self"
bb0(%0 : @guaranteed $S):
  debug_value %0 : $S, let, name "self", argno 1
  %2 = alloc_stack $S
  %3 = store_borrow %0 to %2 : $*S
  %4 = load_borrow %3 : $*S
  fix_lifetime %4 : $S
  end_borrow %4 : $S
  end_borrow %3 : $*S
  dealloc_stack %2 : $*S
  %8 = tuple ()
  return %8 : $()
}

// CHECK-LABEL: sil [ossa] @dce_destroy_of_live_copy : {{.*}} {
// CHECK:         [[COPY:%[^,]+]] = copy_value
// CHECK:         cond_br {{%[^,]+}}, [[LEFT:bb[0-9]+]], [[RIGHT:bb[0-9]+]]
// CHECK:       [[LEFT]]:
// CHECK:         destroy_value [[COPY]]
// CHECK:         br [[EXIT:bb[0-9]+]]
// CHECK:       [[RIGHT]]:
// CHECK:         destroy_value [[COPY]]
// CHECK:         br [[EXIT]]
// CHECK:       [[EXIT]]:
// CHECK-LABEL: } // end sil function 'dce_destroy_of_live_copy'
sil [ossa] @dce_destroy_of_live_copy : $@convention(thin) (Int1) -> () {
entry(%condition : $Int1):
  %instance = apply undef() : $@convention(thin) () -> (@owned C)
  %borrow = begin_borrow %instance : $C
  %aggregate = struct $CAndBit(%borrow : $C, %condition : $Int1)
  %copy = copy_value %aggregate : $CAndBit
  end_borrow %borrow : $C
  %borrow2 = begin_borrow %copy : $CAndBit
  %bit = struct_extract %borrow2 : $CAndBit, #CAndBit.bit
  end_borrow %borrow2 : $CAndBit
  apply undef(%bit) : $@convention(thin) (Int1) -> ()
  cond_br %condition, left, right
left:
  destroy_value %copy : $CAndBit
  br exit
right:
  destroy_value %copy : $CAndBit
  br exit
exit:
  destroy_value %instance : $C
  %retval = tuple ()
  return %retval : $()
}

// Test that DCE does not eliminate a drop_deinit.
//
// rdar://109863801 ([move-only] DCE removes drop_deinit, so
// user-defined deinitializers call themselves recursively at -O)
//
// CHECK-LABEL: sil hidden [ossa] @testDropDeinit : $@convention(method) (@owned MO) -> () {
// CHECK: [[DROP:%.*]] = drop_deinit %0 : $MO
// CHECK: end_lifetime [[DROP]] : $MO
// CHECK-LABEL: } // end sil function 'testDropDeinit'
//
// MO.deinit
sil hidden [ossa] @testDropDeinit : $@convention(method) (@owned MO) -> () {
bb0(%0 : @owned $MO):
  debug_value %0 : $MO, let, name "self", argno 1
  %61 = drop_deinit %0 : $MO
  end_lifetime %61 : $MO
  %63 = tuple ()
  return %63 : $()
}

// The InstructionDeleter will delete the `load [take]` and insert a
// `destroy_addr`.  Observe the creation of the new destroy_addr instruction
// that occurs when deleting the `load [take]` and mark it live.  Prevents a
// leak.
// CHECK-LABEL: sil [ossa] @keep_new_destroy_addr : {{.*}} {
// CHECK:         destroy_addr
// CHECK-LABEL: } // end sil function 'keep_new_destroy_addr'
sil [ossa] @keep_new_destroy_addr : $@convention(thin) () -> () {
bb0:
  try_apply undef() : $@convention(thin) () -> @error any Error, normal bb1, error bb5

bb1(%4 : $()):
  %err = alloc_stack $any Error
  try_apply undef<any Error>(%err) : $@convention(method) <τ_1_1 where τ_1_1 : Error> () -> (@error_indirect τ_1_1), normal bb2, error bb6

bb2(%15 : $()):
  dealloc_stack %err : $*any Error
  br bb3

bb4(%24 : @owned $any Error):
  destroy_value %24 : $any Error
  br bb3

bb5(%30 : @owned $any Error):
  br bb4(%30 : $any Error)

bb6:
  %33 = load [take] %err : $*any Error
  dealloc_stack %err : $*any Error
  br bb4(%33 : $any Error)

bb3:
  %22 = tuple ()
  return %22 : $()
}

// CHECK-LABEL: sil [ossa] @dont_delete_move_value_lexical : {{.*}} {
// CHECK:         [[LEXICAL:%[^,]+]] = move_value [lexical]
// CHECK:         [[DUMMY:%[^,]+]] = function_ref @dummy
// CHECK:         apply [[DUMMY]]()
// CHECK:         destroy_value [[LEXICAL]]
// CHECK-LABEL: } // end sil function 'dont_delete_move_value_lexical'
sil [ossa] @dont_delete_move_value_lexical : $@convention(thin) () -> () {
  %getC = function_ref @getC : $@convention(thin) () -> @owned C
  %c = apply %getC() : $@convention(thin) () -> @owned C
  %m = move_value [lexical] %c : $C
  %dummy = function_ref @dummy : $@convention(thin) () -> ()
  apply %dummy() : $@convention(thin) () -> ()
  destroy_value %m : $C
  %retval = tuple ()
  return %retval : $()
}