File: basic-callee-printer.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 (720 lines) | stat: -rw-r--r-- 29,058 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
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
// RUN: %target-sil-opt -sil-print-debuginfo -enable-sil-verify-all %s -basic-callee-printer -o /dev/null | %FileCheck --check-prefix=CHECK --check-prefix=CHECK-NOWMO %s
// RUN: %target-sil-opt -sil-print-debuginfo -enable-sil-verify-all %s -wmo -basic-callee-printer -o /dev/null | %FileCheck --check-prefix=CHECK --check-prefix=CHECK-WMO %s

sil_stage canonical

sil private @private_bottom : $@convention(thin) () -> () {
bb0:
  %0 = tuple ()
  return %0 : $()
}

// CHECK-LABEL: Function call site:
// CHECK:   // function_ref private_bottom
// CHECK:   %0 = function_ref @private_bottom : $@convention(thin) () -> (){{.*}} // user: %1
// CHECK:   %1 = apply %0() : $@convention(thin) () -> ()
// CHECK: Incomplete callee list? : No
// CHECK: Known callees:
// CHECK: private_bottom
sil private @private_middle : $@convention(thin) () -> () {
bb0:
  %0 = function_ref @private_bottom : $@convention(thin) () -> ()
  %1 = apply %0() : $@convention(thin) () -> ()
  %2 = tuple ()
  return %2 : $()
}


// CHECK-LABEL: Function call site:
// CHECK:   // function_ref private_middle
// CHECK:   %0 = function_ref @private_middle : $@convention(thin) () -> (){{.*}} // user: %1
// CHECK:   %1 = apply %0() : $@convention(thin) () -> ()
// CHECK: Incomplete callee list? : No
// CHECK: Known callees:
// CHECK: private_middle
sil private @private_top : $@convention(thin) () -> () {
bb0:
  %0 = function_ref @private_middle : $@convention(thin) () -> ()
  %1 = apply %0() : $@convention(thin) () -> ()
  %2 = tuple ()
  return %2 : $()
}


sil hidden @internal_bottom : $@convention(thin) () -> () {
bb0:
  %0 = tuple ()
  return %0 : $()
}


// CHECK-LABEL: Function call site:
// CHECK:   // function_ref internal_bottom
// CHECK:   %0 = function_ref @internal_bottom : $@convention(thin) () -> (){{.*}} // user: %1
// CHECK:   %1 = apply %0() : $@convention(thin) () -> ()
// CHECK: Incomplete callee list? : No
// CHECK: Known callees:
// CHECK: internal_bottom
sil hidden @internal_middle : $@convention(thin) () -> () {
bb0:
  %0 = function_ref @internal_bottom : $@convention(thin) () -> ()
  %1 = apply %0() : $@convention(thin) () -> ()
  %2 = tuple ()
  return %2 : $()
}


// CHECK-LABEL: Function call site:
// CHECK:   // function_ref internal_middle
// CHECK:   %0 = function_ref @internal_middle : $@convention(thin) () -> (){{.*}} // user: %1
// CHECK:   %1 = apply %0() : $@convention(thin) () -> ()
// CHECK: Incomplete callee list? : No
// CHECK: Known callees:
// CHECK: internal_middle
sil hidden @internal_top : $@convention(thin) () -> () {
bb0:
  %0 = function_ref @internal_middle : $@convention(thin) () -> ()
  %1 = apply %0() : $@convention(thin) () -> ()
  %2 = tuple ()
  return %2 : $()
}


sil @public_bottom : $@convention(thin) () -> () {
bb0:
  %0 = tuple ()
  return %0 : $()
}


// CHECK-LABEL: Function call site:
// CHECK:   // function_ref public_bottom
// CHECK:   %0 = function_ref @public_bottom : $@convention(thin) () -> (){{.*}} // user: %1
// CHECK:   %1 = apply %0() : $@convention(thin) () -> ()
// CHECK: Incomplete callee list? : No
// CHECK: Known callees:
// CHECK: public_bottom
sil @public_middle : $@convention(thin) () -> () {
bb0:
  %0 = function_ref @public_bottom : $@convention(thin) () -> ()
  %1 = apply %0() : $@convention(thin) () -> ()
  %2 = tuple ()
  return %2 : $()
}


// CHECK-LABEL: Function call site:
// CHECK:   // function_ref public_middle
// CHECK:   %0 = function_ref @public_middle : $@convention(thin) () -> (){{.*}} // user: %1
// CHECK:   %1 = apply %0() : $@convention(thin) () -> ()
// CHECK: Incomplete callee list? : No
// CHECK: Known callees:
// CHECK: public_middle
sil @public_top : $@convention(thin) () -> () {
bb0:
  %0 = function_ref @public_middle : $@convention(thin) () -> ()
  %1 = apply %0() : $@convention(thin) () -> ()
  %2 = tuple ()
  return %2 : $()
}


private class private_base {
  func foo()
}

private class private_derived : private_base {
  override func foo()
}

@inline(never) private func call_private(b: private_base)

class internal_base {
  func foo()
  private func bar()
}

class internal_derived : internal_base {
  override func foo()
  override func bar()
}

@inline(never) func call_internal(b: internal_base)

open class public_base {
  func foo()
  open func bar()
  private func baz()
}

open class public_derived : public_base {
  override func foo()
  open override func bar()
  open override func baz()
}


sil private @private_base_foo : $@convention(method) (@guaranteed private_base) -> () {
bb0(%0 : $private_base):
  debug_value %0 : $private_base
  %2 = tuple ()
  return %2 : $()
}


sil private @private_derived_foo : $@convention(method) (@guaranteed private_derived) -> () {
bb0(%0 : $private_derived):
  debug_value %0 : $private_derived
  %2 = tuple ()
  return %2 : $()
}


// CHECK-LABEL: Function call site:
// CHECK:   %2 = class_method %0 : $private_base, #private_base.foo : (private_base) -> () -> (), $@convention(method) (@guaranteed private_base) -> (),{{.*}} // user: %3
// CHECK:   %3 = apply %2(%0) : $@convention(method) (@guaranteed private_base) -> ()
// CHECK: Incomplete callee list? : No
// CHECK: Known callees:
// CHECK: private_base_foo
// CHECK: private_derived_foo
sil private [noinline] @call_private : $@convention(thin) (@owned private_base) -> () {
bb0(%0 : $private_base):
  debug_value %0 : $private_base
  %2 = class_method %0 : $private_base, #private_base.foo : (private_base) -> () -> (), $@convention(method) (@guaranteed private_base) -> ()
  %3 = apply %2(%0) : $@convention(method) (@guaranteed private_base) -> ()
  strong_release %0 : $private_base
  %5 = tuple ()
  return %5 : $()
}


sil hidden @internal_base_foo : $@convention(method) (@guaranteed internal_base) -> () {
bb0(%0 : $internal_base):
  debug_value %0 : $internal_base
  %2 = tuple ()
  return %2 : $()
}


sil private @internal_base_bar : $@convention(method) (@guaranteed internal_base) -> () {
bb0(%0 : $internal_base):
  debug_value %0 : $internal_base
  %2 = tuple ()
  return %2 : $()
}


sil hidden @internal_derived_foo : $@convention(method) (@guaranteed internal_derived) -> () {
bb0(%0 : $internal_derived):
  debug_value %0 : $internal_derived
  %2 = tuple ()
  return %2 : $()
}


sil hidden @internal_derived_bar : $@convention(method) (@guaranteed internal_derived) -> () {
bb0(%0 : $internal_derived):
  debug_value %0 : $internal_derived
  %2 = tuple ()
  return %2 : $()
}

// CHECK-LABEL: Function call site:
// CHECK:     %2 = class_method %0 : $internal_base, #internal_base.foo : (internal_base) -> () -> (), $@convention(method) (@guaranteed internal_base) -> ()
// CHECK:     %3 = apply %2(%0) : $@convention(method) (@guaranteed internal_base) -> ()
// CHECK-NOWMO: Incomplete callee list? : Yes
// CHECK-WMO: Incomplete callee list? : No
// CHECK:   Known callees:
// CHECK:   internal_base_foo
// CHECK:   internal_derived_foo

// CHECK-LABEL: Function call site:
// CHECK:   %4 = class_method %0 : $internal_base, #internal_base.bar : (internal_base) -> () -> (), $@convention(method) (@guaranteed internal_base) -> (){{.*}} // user: %5
// CHECK:   %5 = apply %4(%0) : $@convention(method) (@guaranteed internal_base) -> ()
// CHECK-NOWMO: Incomplete callee list? : Yes
// CHECK-WMO: Incomplete callee list? : No
// CHECK: Known callees:
// CHECK: internal_base_bar
// CHECK: internal_derived_bar
sil hidden [noinline] @call_internal : $@convention(thin) (@owned internal_base) -> () {
bb0(%0 : $internal_base):
  debug_value %0 : $internal_base
  %2 = class_method %0 : $internal_base, #internal_base.foo : (internal_base) -> () -> (), $@convention(method) (@guaranteed internal_base) -> ()
  %3 = apply %2(%0) : $@convention(method) (@guaranteed internal_base) -> ()
  %4 = class_method %0 : $internal_base, #internal_base.bar : (internal_base) -> () -> (), $@convention(method) (@guaranteed internal_base) -> ()
  %5 = apply %4(%0) : $@convention(method) (@guaranteed internal_base) -> ()
  strong_release %0 : $internal_base
  %7 = tuple ()
  return %7 : $()
}


sil hidden @public_base_foo : $@convention(method) (@guaranteed public_base) -> () {
bb0(%0 : $public_base):
  debug_value %0 : $public_base
  %2 = tuple ()
  return %2 : $()
}


sil @public_base_bar : $@convention(method) (@guaranteed public_base) -> () {
bb0(%0 : $public_base):
  debug_value %0 : $public_base
  %2 = tuple ()
  return %2 : $()
}


sil private @public_base_baz : $@convention(method) (@guaranteed public_base) -> () {
bb0(%0 : $public_base):
  debug_value %0 : $public_base
  %2 = tuple ()
  return %2 : $()
}


sil hidden @public_derived_foo : $@convention(method) (@guaranteed public_derived) -> () {
bb0(%0 : $public_derived):
  debug_value %0 : $public_derived
  %2 = tuple ()
  return %2 : $()
}


sil @public_derived_bar : $@convention(method) (@guaranteed public_derived) -> () {
bb0(%0 : $public_derived):
  debug_value %0 : $public_derived
  %2 = tuple ()
  return %2 : $()
}


sil @public_derived_baz : $@convention(method) (@guaranteed public_derived) -> () {
bb0(%0 : $public_derived):
  debug_value %0 : $public_derived
  %2 = tuple ()
  return %2 : $()
}


// CHECK-LABEL: Function call site:
// CHECK:   %2 = class_method %0 : $public_base, #public_base.foo : (public_base) -> () -> (), $@convention(method) (@guaranteed public_base) -> (){{.*}} // user: %3
// CHECK:   %3 = apply %2(%0) : $@convention(method) (@guaranteed public_base) -> ()
// CHECK-NOWMO: Incomplete callee list? : Yes
// CHECK-WMO: Incomplete callee list? : No
// CHECK: Known callees:
// CHECK: public_base_foo
// CHECK: public_derived_foo
//
// CHECK-LABEL: Function call site:
// CHECK:   %4 = class_method %0 : $public_base, #public_base.bar : (public_base) -> () -> (), $@convention(method) (@guaranteed public_base) -> (){{.*}} // user: %5
// CHECK:   %5 = apply %4(%0) : $@convention(method) (@guaranteed public_base) -> ()
// CHECK: Incomplete callee list? : Yes
// CHECK: Known callees:
// CHECK: public_base_bar
// CHECK: public_derived_bar
//
// CHECK-LABEL: Function call site:
// CHECK:   %6 = class_method %0 : $public_base, #public_base.baz : (public_base) -> () -> (), $@convention(method) (@guaranteed public_base) -> (){{.*}} // user: %7
// CHECK:   %7 = apply %6(%0) : $@convention(method) (@guaranteed public_base) -> ()
// CHECK: Incomplete callee list? : Yes
// CHECK: Known callees:
// CHECK: public_base_baz
// CHECK: public_derived_baz
sil hidden [noinline] @call_public : $@convention(thin) (@owned public_base) -> () {
bb0(%0 : $public_base):
  debug_value %0 : $public_base
  %2 = class_method %0 : $public_base, #public_base.foo : (public_base) -> () -> (), $@convention(method) (@guaranteed public_base) -> ()
  %3 = apply %2(%0) : $@convention(method) (@guaranteed public_base) -> ()
  %4 = class_method %0 : $public_base, #public_base.bar : (public_base) -> () -> (), $@convention(method) (@guaranteed public_base) -> ()
  %5 = apply %4(%0) : $@convention(method) (@guaranteed public_base) -> ()
  %6 = class_method %0 : $public_base, #public_base.baz : (public_base) -> () -> (), $@convention(method) (@guaranteed public_base) -> ()
  %7 = apply %6(%0) : $@convention(method) (@guaranteed public_base) -> ()
  strong_release %0 : $public_base
  %9 = tuple ()
  return %9 : $()
}

sil_vtable private_base {
  #private_base.foo: @private_base_foo
}

sil_vtable private_derived {
  #private_base.foo: @private_derived_foo [override]
}

sil_vtable internal_base {
  #internal_base.foo: @internal_base_foo
  #internal_base.bar: @internal_base_bar
}

sil_vtable internal_derived {
  #internal_base.foo: @internal_derived_foo [override]
  #internal_base.bar: @internal_derived_bar [override]
}

sil_vtable public_base {
  #public_base.foo: @public_base_foo
  #public_base.bar: @public_base_bar
  #public_base.baz: @public_base_baz
}

sil_vtable public_derived {
  #public_base.foo: @public_derived_foo [override]
  #public_base.bar: @public_derived_bar [override]
  #public_base.baz: @public_derived_baz [override]
}

private protocol private_proto_1 {
  func theMethod()
}

private class private_proto_private_class : private_proto_1 {
  func theMethod()
}

private func call_through_private_proto_1<T : private_proto_1>(x: T)

private protocol private_proto_2 {
  func theMethod()
}

class private_proto_internal_class : private_proto_2 {
  func theMethod()
}

private func call_through_private_proto_2<T : private_proto_2>(x: T)

private protocol private_proto_3 {
  func theMethod()
}

open class private_proto_public_class : private_proto_3 {
  open func theMethod()
}

private func call_through_private_proto_3<T : private_proto_3>(x: T)

private protocol private_proto_4 {
  func theMethod()
}

open class private_proto_public_class_private_method : private_proto_4 {
  fileprivate func theMethod()
}

private func call_through_private_proto_4<T : private_proto_4>(x: T)

sil private @private_proto_private_class_theMethod : $@convention(method) (@guaranteed private_proto_private_class) -> () {
bb0(%0 : $private_proto_private_class):
  debug_value %0 : $private_proto_private_class
  %2 = tuple ()
  return %2 : $()
}


// CHECK-LABEL: Function call site:
// CHECK:   %3 = class_method %1 : $private_proto_private_class, #private_proto_private_class.theMethod : (private_proto_private_class) -> () -> (), $@convention(method) (@guaranteed private_proto_private_class) -> (){{.*}} // user: %4
// CHECK:   %4 = apply %3(%1) : $@convention(method) (@guaranteed private_proto_private_class) -> (){{.*}} // user: %6
// CHECK: Incomplete callee list? : No
// CHECK: Known callees:
// CHECK: private_proto_private_class_theMethod
sil private [transparent] [thunk] @private_proto_1_private_class_witness : $@convention(witness_method: private_proto_1) (@in_guaranteed private_proto_private_class) -> () {
bb0(%0 : $*private_proto_private_class):
  %1 = load %0 : $*private_proto_private_class
  strong_retain %1 : $private_proto_private_class
  %3 = class_method %1 : $private_proto_private_class, #private_proto_private_class.theMethod : (private_proto_private_class) -> () -> (), $@convention(method) (@guaranteed private_proto_private_class) -> ()
  %4 = apply %3(%1) : $@convention(method) (@guaranteed private_proto_private_class) -> ()
  strong_release %1 : $private_proto_private_class
  return %4 : $()
}


// CHECK-LABEL: Function call site:
// CHECK:   %2 = witness_method $T, #private_proto_1.theMethod : {{.*}} : $@convention(witness_method: private_proto_1) <τ_0_0 where τ_0_0 : private_proto_1> (@in_guaranteed τ_0_0) -> (){{.*}} // user: %3
// CHECK:   %3 = apply %2<T>(%0) : $@convention(witness_method: private_proto_1) <τ_0_0 where τ_0_0 : private_proto_1> (@in_guaranteed τ_0_0) -> ()
// CHECK: Incomplete callee list? : No
// CHECK: Known callees:
// CHECK: private_proto_1_private_class_witness
sil private @call_through_private_proto_1 : $@convention(thin) <T where T : private_proto_1> (@in T) -> () {
bb0(%0 : $*T):
  debug_value %0 : $*T, expr op_deref
  %2 = witness_method $T, #private_proto_1.theMethod : $@convention(witness_method: private_proto_1) <τ_0_0 where τ_0_0 : private_proto_1> (@in_guaranteed τ_0_0) -> ()
  %3 = apply %2<T>(%0) : $@convention(witness_method: private_proto_1) <τ_0_0 where τ_0_0 : private_proto_1> (@in_guaranteed τ_0_0) -> ()
  destroy_addr %0 : $*T
  %5 = tuple ()
  return %5 : $()
}


sil hidden @private_proto_internal_class_theMethod : $@convention(method) (@guaranteed private_proto_internal_class) -> () {
bb0(%0 : $private_proto_internal_class):
  debug_value %0 : $private_proto_internal_class
  %2 = tuple ()
  return %2 : $()
}


// CHECK-LABEL: Function call site:
// CHECK:   %3 = class_method %1 : $private_proto_internal_class, #private_proto_internal_class.theMethod : (private_proto_internal_class) -> () -> (), $@convention(method) (@guaranteed private_proto_internal_class) -> (){{.*}} // user: %4
// CHECK:   %4 = apply %3(%1) : $@convention(method) (@guaranteed private_proto_internal_class) -> (){{.*}} // user: %6
// CHECK-NOWMO: Incomplete callee list? : Yes
// CHECK-WMO: Incomplete callee list? : No
// CHECK: Known callees:
// CHECK: private_proto_internal_class_theMethod
sil private [transparent] [thunk] @private_proto_2_internal_class_witness : $@convention(witness_method: private_proto_2) (@in_guaranteed private_proto_internal_class) -> () {
bb0(%0 : $*private_proto_internal_class):
  %1 = load %0 : $*private_proto_internal_class
  strong_retain %1 : $private_proto_internal_class
  %3 = class_method %1 : $private_proto_internal_class, #private_proto_internal_class.theMethod : (private_proto_internal_class) -> () -> (), $@convention(method) (@guaranteed private_proto_internal_class) -> ()
  %4 = apply %3(%1) : $@convention(method) (@guaranteed private_proto_internal_class) -> ()
  strong_release %1 : $private_proto_internal_class
  return %4 : $()
}


// CHECK-LABEL: Function call site:
// CHECK:   %2 = witness_method $T, #private_proto_2.theMethod : {{.*}} : $@convention(witness_method: private_proto_2) <τ_0_0 where τ_0_0 : private_proto_2> (@in_guaranteed τ_0_0) -> (){{.*}} // user: %3
// CHECK:   %3 = apply %2<T>(%0) : $@convention(witness_method: private_proto_2) <τ_0_0 where τ_0_0 : private_proto_2> (@in_guaranteed τ_0_0) -> ()
// CHECK-WMO: Incomplete callee list? : No
// CHECK-NOWMO: Incomplete callee list? : Yes
// CHECK: Known callees:
// CHECK: private_proto_2_internal_class_witness
sil private @call_through_private_proto_2 : $@convention(thin) <T where T : private_proto_2> (@in T) -> () {
bb0(%0 : $*T):
  debug_value %0 : $*T, expr op_deref
  %2 = witness_method $T, #private_proto_2.theMethod : $@convention(witness_method: private_proto_2) <τ_0_0 where τ_0_0 : private_proto_2> (@in_guaranteed τ_0_0) -> ()
  %3 = apply %2<T>(%0) : $@convention(witness_method: private_proto_2) <τ_0_0 where τ_0_0 : private_proto_2> (@in_guaranteed τ_0_0) -> ()
  destroy_addr %0 : $*T
  %5 = tuple ()
  return %5 : $()
}


sil @private_proto_public_class_theMethod : $@convention(method) (@guaranteed private_proto_public_class) -> () {
bb0(%0 : $private_proto_public_class):
  debug_value %0 : $private_proto_public_class
  %2 = tuple ()
  return %2 : $()
}


// CHECK-LABEL: Function call site:
// CHECK:   %3 = class_method %1 : $private_proto_public_class, #private_proto_public_class.theMethod : (private_proto_public_class) -> () -> (), $@convention(method) (@guaranteed private_proto_public_class) -> (){{.*}} // user: %4
// CHECK:   %4 = apply %3(%1) : $@convention(method) (@guaranteed private_proto_public_class) -> (){{.*}} // user: %6
// CHECK: Incomplete callee list? : Yes
// CHECK: Known callees:
// CHECK: private_proto_public_class_theMethod
sil private [transparent] [thunk] @private_proto_3_public_class_witness : $@convention(witness_method: private_proto_3) (@in_guaranteed private_proto_public_class) -> () {
bb0(%0 : $*private_proto_public_class):
  %1 = load %0 : $*private_proto_public_class
  strong_retain %1 : $private_proto_public_class
  %3 = class_method %1 : $private_proto_public_class, #private_proto_public_class.theMethod : (private_proto_public_class) -> () -> (), $@convention(method) (@guaranteed private_proto_public_class) -> ()
  %4 = apply %3(%1) : $@convention(method) (@guaranteed private_proto_public_class) -> ()
  strong_release %1 : $private_proto_public_class
  return %4 : $()
}


// CHECK-LABEL: Function call site:
// CHECK:   %2 = witness_method $T, #private_proto_3.theMethod : {{.*}} : $@convention(witness_method: private_proto_3) <τ_0_0 where τ_0_0 : private_proto_3> (@in_guaranteed τ_0_0) -> (){{.*}} // user: %3
// CHECK:   %3 = apply %2<T>(%0) : $@convention(witness_method: private_proto_3) <τ_0_0 where τ_0_0 : private_proto_3> (@in_guaranteed τ_0_0) -> ()
// CHECK: Incomplete callee list? : Yes
// CHECK: Known callees:
// CHECK: private_proto_3_public_class_witness
sil private @call_through_private_proto_3 : $@convention(thin) <T where T : private_proto_3> (@in T) -> () {
bb0(%0 : $*T):
  debug_value %0 : $*T, expr op_deref
  %2 = witness_method $T, #private_proto_3.theMethod : $@convention(witness_method: private_proto_3) <τ_0_0 where τ_0_0 : private_proto_3> (@in_guaranteed τ_0_0) -> ()
  %3 = apply %2<T>(%0) : $@convention(witness_method: private_proto_3) <τ_0_0 where τ_0_0 : private_proto_3> (@in_guaranteed τ_0_0) -> ()
  destroy_addr %0 : $*T
  %5 = tuple ()
  return %5 : $()
}


sil private @private_proto_public_class_private_method_theMethod : $@convention(method) (@guaranteed private_proto_public_class_private_method) -> () {
bb0(%0 : $private_proto_public_class_private_method):
  debug_value %0 : $private_proto_public_class_private_method
  %2 = tuple ()
  return %2 : $()
}


// CHECK-LABEL: Function call site:
// CHECK:   %3 = class_method %1 : $private_proto_public_class_private_method, #private_proto_public_class_private_method.theMethod : (private_proto_public_class_private_method) -> () -> (), $@convention(method) (@guaranteed private_proto_public_class_private_method) -> (){{.*}} // user: %4
// CHECK:   %4 = apply %3(%1) : $@convention(method) (@guaranteed private_proto_public_class_private_method) -> (){{.*}} // user: %6
// CHECK: Incomplete callee list? : No
// CHECK: Known callees:
// CHECK: private_proto_public_class_private_method_theMethod
sil private [transparent] [thunk] @private_proto_4_public_class_private_method_witness : $@convention(witness_method: private_proto_4) (@in_guaranteed private_proto_public_class_private_method) -> () {
bb0(%0 : $*private_proto_public_class_private_method):
  %1 = load %0 : $*private_proto_public_class_private_method
  strong_retain %1 : $private_proto_public_class_private_method
  %3 = class_method %1 : $private_proto_public_class_private_method, #private_proto_public_class_private_method.theMethod : (private_proto_public_class_private_method) -> () -> (), $@convention(method) (@guaranteed private_proto_public_class_private_method) -> ()
  %4 = apply %3(%1) : $@convention(method) (@guaranteed private_proto_public_class_private_method) -> ()
  strong_release %1 : $private_proto_public_class_private_method
  return %4 : $()
}


// CHECK-LABEL: Function call site:
// CHECK:   %2 = witness_method $T, #private_proto_4.theMethod : {{.*}} : $@convention(witness_method: private_proto_4) <τ_0_0 where τ_0_0 : private_proto_4> (@in_guaranteed τ_0_0) -> (){{.*}} // user: %3
// CHECK:   %3 = apply %2<T>(%0) : $@convention(witness_method: private_proto_4) <τ_0_0 where τ_0_0 : private_proto_4> (@in_guaranteed τ_0_0) -> ()
// CHECK: Incomplete callee list? : No
// CHECK: Known callees:
// CHECK: private_proto_4_public_class_private_method_witness
sil private @call_through_private_proto_4 : $@convention(thin) <T where T : private_proto_4> (@in T) -> () {
bb0(%0 : $*T):
  debug_value %0 : $*T, expr op_deref
  %2 = witness_method $T, #private_proto_4.theMethod : $@convention(witness_method: private_proto_4) <τ_0_0 where τ_0_0 : private_proto_4> (@in_guaranteed τ_0_0) -> ()
  %3 = apply %2<T>(%0) : $@convention(witness_method: private_proto_4) <τ_0_0 where τ_0_0 : private_proto_4> (@in_guaranteed τ_0_0) -> ()
  destroy_addr %0 : $*T
  %5 = tuple ()
  return %5 : $()
}


sil_vtable private_proto_private_class {
  #private_proto_private_class.theMethod: @private_proto_private_class_theMethod
}

sil_vtable private_proto_internal_class {
  #private_proto_internal_class.theMethod: @private_proto_internal_class_theMethod
}

sil_vtable private_proto_public_class {
  #private_proto_public_class.theMethod: @private_proto_public_class_theMethod
}

sil_vtable private_proto_public_class_private_method {
  #private_proto_public_class_private_method.theMethod: @private_proto_public_class_private_method_theMethod
}

sil_witness_table private private_proto_private_class: private_proto_1 module witness {
  method #private_proto_1.theMethod: @private_proto_1_private_class_witness
}

sil_witness_table private private_proto_internal_class: private_proto_2 module witness {
  method #private_proto_2.theMethod: @private_proto_2_internal_class_witness
}

sil_witness_table private private_proto_public_class: private_proto_3 module witness {
  method #private_proto_3.theMethod: @private_proto_3_public_class_witness
}

sil_witness_table private private_proto_public_class_private_method: private_proto_4 module witness {
  method #private_proto_4.theMethod: @private_proto_4_public_class_private_method_witness
}

// Test initializer vs allocator

struct InitVal { }

class SomeItem {
  required init(ivalreq: InitVal)
  convenience init(ival: InitVal)
  deinit
}

class SomeChildItem : SomeItem {
  deinit
  required init(ivalreq: InitVal)
}

sil @test_call_of_allocator_and_initializer : $@convention(thin) (@thick SomeItem.Type, InitVal) -> @owned SomeItem {
bb0(%0 : $@thick SomeItem.Type, %1: $InitVal):

// CHECK-LABEL: Function call site:
// CHECK:   %2 = class_method %0 : $@thick SomeItem.Type, #SomeItem.init!allocator : (SomeItem.Type) -> (InitVal) -> SomeItem, $@convention(method) (InitVal, @thick SomeItem.Type) -> @owned SomeItem
// CHECK:   %3 = apply %2(%1, %0) : $@convention(method) (InitVal, @thick SomeItem.Type) -> @owned SomeItem
// CHECK-NOWMO: Incomplete callee list? : Yes
// CHECK-WMO: Incomplete callee list? : No
// CHECK: Known callees:
// CHECK: SomeChildItem_allocator
// CHECK: SomeItem_allocator

  %2 = class_method %0 : $@thick SomeItem.Type, #SomeItem.init!allocator : (SomeItem.Type) -> (InitVal) -> SomeItem, $@convention(method) (InitVal, @thick SomeItem.Type) -> @owned SomeItem
  %3 = apply %2(%1, %0) : $@convention(method) (InitVal, @thick SomeItem.Type) -> @owned SomeItem

  return %3 : $SomeItem
}

sil @SomeItem_allocator : $@convention(method) (InitVal, @thick SomeItem.Type) -> @owned SomeItem

sil @SomeItem_initializer : $@convention(method) (InitVal, @owned SomeItem) -> @owned SomeItem

sil @SomeItem_destructor : $@convention(method) (@owned SomeItem) -> ()

sil @SomeChildItem_allocator : $@convention(method) (InitVal, @thick SomeChildItem.Type) -> @owned SomeChildItem

sil @SomeChildItem_initializer : $@convention(method) (InitVal, @owned SomeChildItem) -> @owned SomeChildItem

sil @SomeChildItem_destructor : $@convention(method) (@owned SomeChildItem) -> ()

sil_vtable SomeItem {
  #SomeItem.init!allocator: @SomeItem_allocator
  #SomeItem.init!initializer: @SomeItem_initializer
  #SomeItem.deinit!deallocator: @SomeItem_destructor
}

sil_vtable SomeChildItem {
  #SomeItem.init!allocator: @SomeChildItem_allocator [override]
  #SomeItem.init!initializer: @SomeChildItem_initializer [override]
  #SomeChildItem.deinit!deallocator: @SomeChildItem_destructor
}

public protocol PublicProtocol {
  func foo()
}

struct SingleConformance : PublicProtocol {
  func foo()
}

public func testit(p: PublicProtocol)

sil private [transparent] [thunk] @foo_impl : $@convention(witness_method: PublicProtocol) (@in_guaranteed SingleConformance) -> () {
bb0(%0 : $*SingleConformance):
  %4 = tuple ()
  return %4 : $()
}

// CHECK-LABEL: Function call site:
// CHECK:   witness_method $@opened{{.*}} PublicProtocol
// CHECK:   apply {{.*}} PublicProtocol
// CHECK-NOWMO: Incomplete callee list? : Yes
// CHECK-WMO: Incomplete callee list? : Yes
// CHECK: Known callees:
sil @call_foo : $@convention(thin) (@in PublicProtocol) -> () {
bb0(%0 : $*PublicProtocol):
  %5 = open_existential_addr immutable_access %0 : $*PublicProtocol to $*@opened("2226A1AC-2B95-11E8-BDF4-D0817AD3F637", PublicProtocol) Self
  %6 = witness_method $@opened("2226A1AC-2B95-11E8-BDF4-D0817AD3F637", PublicProtocol) Self, #PublicProtocol.foo : <Self where Self : PublicProtocol> (Self) -> () -> (), %5 : $*@opened("2226A1AC-2B95-11E8-BDF4-D0817AD3F637", PublicProtocol) Self : $@convention(witness_method: PublicProtocol) <τ_0_0 where τ_0_0 : PublicProtocol> (@in_guaranteed τ_0_0) -> ()
  %7 = apply %6<@opened("2226A1AC-2B95-11E8-BDF4-D0817AD3F637", PublicProtocol) Self>(%5) : $@convention(witness_method: PublicProtocol) <τ_0_0 where τ_0_0 : PublicProtocol> (@in_guaranteed τ_0_0) -> ()
  destroy_addr %0 : $*PublicProtocol
  %10 = tuple ()
  return %10 : $()
}

sil_witness_table hidden SingleConformance: PublicProtocol module nix {
  method #PublicProtocol.foo: <Self where Self : PublicProtocol> (Self) -> () -> () : @foo_impl
}

sil @closureIntArg : $@convention(thin) (InitVal) -> ()

// CHECK-LABEL-LABEL: Function call site:
// CHECK: convert_escape_to_noescape
// CHECK: apply %{{.*}}() : $@noescape @callee_guaranteed () -> ()
// CHECK: Incomplete callee list? : No
// CHECK: Known callees:
// CHECK: closureIntArg
sil @call_noescape_closure : $@convention(thin) (InitVal) -> () {
entry(%0 : $InitVal):
  %f = function_ref @closureIntArg : $@convention(thin) (InitVal) -> ()
  %e = partial_apply [callee_guaranteed] %f(%0) : $@convention(thin) (InitVal) -> ()
  %n = convert_escape_to_noescape %e : $@callee_guaranteed () -> () to $@noescape @callee_guaranteed () -> ()
  apply %n() : $@noescape @callee_guaranteed () -> ()
  strong_release %e : $@callee_guaranteed () -> ()
  %t = tuple ()
  return %t : $()
}