File: specialize_inherited.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 (62 lines) | stat: -rw-r--r-- 3,507 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
// RUN: %target-sil-opt -enable-sil-verify-all %s -generic-specializer -module-name inherit | %FileCheck %s

import Builtin
import Swift

class MMFont {
}

struct MMStorage<Key : Hashable, Value> {
}

func ==(lhs: MMObject, rhs: MMObject) -> Bool

class MMObject : Hashable {
  func hash(into hasher: inout Hasher)
}

class MMString : MMObject {
}

// CHECK-LABEL: @caller : $@convention(thin) (Int, Int) -> @owned MMStorage<MMString, Optional<MMFont>> {
sil @caller : $@convention(thin) (Int, Int) -> @owned MMStorage<MMString, Optional<MMFont>> {
bb0(%0 : $Int, %1 : $Int):
  %3 = metatype $@thin MMStorage<MMString, Optional<MMFont>>.Type
  %13 = function_ref @ext_fn1 : $@convention(thin) (Int, @thin MMStorage<MMString, Optional<MMFont>>.Type) -> @owned MMStorage<MMString, Optional<MMFont>>
  %14 = apply %13(%0, %3) : $@convention(thin) (Int, @thin MMStorage<MMString, Optional<MMFont>>.Type) -> @owned MMStorage<MMString, Optional<MMFont>>

  // CHECK: [[STACK:%[0-9]+]] = alloc_stack $MMString
  %37 = alloc_stack $MMString
  // CHECK: [[ID:%[0-9]+]] = function_ref @$s6callee7inherit8MMStringC_AB6MMFontCSgTg5 : $@convention(method) (@owned MMString, Int, @owned MMStorage<MMString, Optional<MMFont>>) -> Bool
  %34 = function_ref @callee : $@convention(method) <τ_0_0, τ_0_1 where τ_0_0 : Hashable> (@in τ_0_0, Int, @owned MMStorage<τ_0_0, τ_0_1>) -> Bool
  // CHECK: [[LOAD:%[0-9]+]] = load [[STACK]]
  // CHECK: apply [[ID]]([[LOAD]], %1, %{{[0-9]+}}) : $@convention(method) (@owned MMString, Int, @owned MMStorage<MMString, Optional<MMFont>>) -> Bool
  %45 = apply %34<MMString, MMFont?>(%37, %1, %14) : $@convention(method) <τ_0_0, τ_0_1 where τ_0_0 : Hashable> (@in τ_0_0, Int, @owned MMStorage<τ_0_0, τ_0_1>) -> Bool
  dealloc_stack %37 : $*MMString

  return %14 : $MMStorage<MMString, Optional<MMFont>>
}

// CHECK-LABEL: @$s6callee7inherit8MMStringC_AB6MMFontCSgTg5 : $@convention(method) (@owned MMString, Int, @owned MMStorage<MMString, Optional<MMFont>>) -> Bool {
// CHECK: [[META:%[0-9]+]] = metatype $@thick MMString.Type
// CHECK: [[ID3:%[0-9]+]] = witness_method $MMString, #Equatable."==" :
// CHECK: [[STACK2:%[0-9]+]] = alloc_stack $MMString
// CHECK: [[STACK3:%[0-9]+]] = alloc_stack $MMString
// CHECK: apply [[ID3]]<MMString>([[STACK2]], [[STACK3]], [[META]]) : $@convention(witness_method: Equatable) <τ_0_0 where τ_0_0 : Equatable> (@in τ_0_0, @in τ_0_0, @thick τ_0_0.Type) -> Bool

// CHECK-LABEL: @callee : $@convention(method) <Key, Value where Key : Hashable> (@in Key, Int, @owned MMStorage<Key, Value>) -> Bool {
sil [noinline] @callee : $@convention(method) <Key, Value where Key : Hashable> (@in Key, Int, @owned MMStorage<Key, Value>) -> Bool {
bb0(%0 : $*Key, %1 : $Int, %2 : $MMStorage<Key, Value>):
  %25 = metatype $@thick Key.Type
  // CHECK: [[ID2:%[0-9]+]] = witness_method $Key, #Equatable."==" :
  %26 = witness_method $Key, #Equatable."==" : $@convention(witness_method: Equatable) <τ_0_0 where τ_0_0 : Equatable> (@in τ_0_0, @in τ_0_0, @thick τ_0_0.Type) -> Bool
  %27 = alloc_stack $Key
  %33 = alloc_stack $Key
  // CHECK: apply [[ID2]]<Key>
  %35 = apply %26<Key>(%27, %33, %25) : $@convention(witness_method: Equatable) <τ_0_0 where τ_0_0 : Equatable> (@in τ_0_0, @in τ_0_0, @thick τ_0_0.Type) -> Bool
  dealloc_stack %33 : $*Key
  dealloc_stack %27 : $*Key
  return %35 : $Bool
}

sil @ext_fn1 : $@convention(thin) (Int, @thin MMStorage<MMString, Optional<MMFont>>.Type) -> @owned MMStorage<MMString, Optional<MMFont>>