@@ -12,51 +12,51 @@ public class A {
12
12
}
13
13
14
14
public protocol P {
15
- func foo() -> Int
15
+ func foo() -> Int64
16
16
}
17
17
18
18
public class B : A, P {
19
- public func foo() -> Int
19
+ public func foo() -> Int64
20
20
@objc deinit
21
21
override init()
22
22
}
23
23
24
24
public class C : A, P {
25
- public func foo() -> Int
25
+ public func foo() -> Int64
26
26
@objc deinit
27
27
override init()
28
28
}
29
29
30
- func imp(x: A & P, y: A & P) -> Int
30
+ func imp(x: A & P, y: A & P) -> Int64
31
31
32
- public func test(x: B, y: C) -> Int
32
+ public func test(x: B, y: C) -> Int64
33
33
34
34
// protocol witness for P.foo() in conformance B
35
- sil shared [transparent] [serialized] [thunk] @Pfoo : $@convention(witness_method: P) (@in_guaranteed B) -> Int {
35
+ sil shared [transparent] [serialized] [thunk] @Pfoo : $@convention(witness_method: P) (@in_guaranteed B) -> Int64 {
36
36
// %0 // user: %1
37
37
bb0(%0 : $*B):
38
38
%1 = load %0 : $*B // users: %2, %3
39
- %2 = class_method %1 : $B, #B.foo!1 : (B) -> () -> Int , $@convention(method) (@guaranteed B) -> Int // user: %3
40
- %3 = apply %2(%1) : $@convention(method) (@guaranteed B) -> Int // user: %4
41
- return %3 : $Int // id: %4
39
+ %2 = class_method %1 : $B, #B.foo!1 : (B) -> () -> Int64 , $@convention(method) (@guaranteed B) -> Int64 // user: %3
40
+ %3 = apply %2(%1) : $@convention(method) (@guaranteed B) -> Int64 // user: %4
41
+ return %3 : $Int64 // id: %4
42
42
} // end sil function 'Pfoo'
43
43
44
44
// B.foo()
45
- sil [noinline] @foo : $@convention(method) (@guaranteed B) -> Int {
45
+ sil [noinline] @foo : $@convention(method) (@guaranteed B) -> Int64 {
46
46
// %0 // user: %1
47
47
bb0(%0 : $B):
48
48
debug_value %0 : $B, let, name "self", argno 1 // id: %1
49
49
%2 = integer_literal $Builtin.Int64, 1 // user: %3
50
- %3 = struct $Int (%2 : $Builtin.Int64) // user: %4
51
- return %3 : $Int // id: %4
50
+ %3 = struct $Int64 (%2 : $Builtin.Int64) // user: %4
51
+ return %3 : $Int64 // id: %4
52
52
} // end sil function 'foo'
53
53
54
54
55
55
// This function calls @impl. The optimizer generates a specialization of impl
56
56
// based on the arguments passed to it here. Even though this function isn't
57
57
// directly checked, it is essentail for the optimization.
58
58
// test(x:y:)
59
- sil @test :$@convention(thin) (@guaranteed B, @guaranteed C) -> Int {
59
+ sil @test :$@convention(thin) (@guaranteed B, @guaranteed C) -> Int64 {
60
60
// %0 // users: %5, %4, %2
61
61
// %1 // users: %7, %6, %3
62
62
bb0(%0 : $B, %1 : $C):
@@ -67,11 +67,11 @@ bb0(%0 : $B, %1 : $C):
67
67
strong_retain %1 : $C // id: %6
68
68
%7 = init_existential_ref %1 : $C : $C, $A & P // users: %10, %9
69
69
// function_ref imp(x:y:)
70
- %8 = function_ref @impl : $@convention(thin) (@guaranteed A & P, @guaranteed A & P) -> Int // user: %9
71
- %9 = apply %8(%5, %7) : $@convention(thin) (@guaranteed A & P, @guaranteed A & P) -> Int // user: %12
70
+ %8 = function_ref @impl : $@convention(thin) (@guaranteed A & P, @guaranteed A & P) -> Int64 // user: %9
71
+ %9 = apply %8(%5, %7) : $@convention(thin) (@guaranteed A & P, @guaranteed A & P) -> Int64 // user: %12
72
72
strong_release %7 : $A & P // id: %10
73
73
strong_release %5 : $A & P // id: %11
74
- return %9 : $Int // id: %12
74
+ return %9 : $Int64 // id: %12
75
75
} // end sil function 'test'
76
76
77
77
// We're looking of an optimized spcialization of @impl, not @impl itself.
@@ -83,7 +83,7 @@ bb0(%0 : $B, %1 : $C):
83
83
// This function will be passed arguments of type B and C for arguments
84
84
// %0 and %1 respectively. We want to make sure that we call B's foo method
85
85
// and not C's foo method.
86
- sil hidden [noinline] @impl : $@convention(thin) (@guaranteed A & P, @guaranteed A & P) -> Int {
86
+ sil hidden [noinline] @impl : $@convention(thin) (@guaranteed A & P, @guaranteed A & P) -> Int64 {
87
87
bb0(%0 : $A & P, %1 : $A & P):
88
88
%2 = open_existential_ref %0 : $A & P to $@opened("A1F1B526-1463-11EA-932F-ACBC329C418B") A & P
89
89
%3 = unchecked_ref_cast %1 : $A & P to $@opened("A1F1B526-1463-11EA-932F-ACBC329C418B") A & P
@@ -94,28 +94,28 @@ bb0(%0 : $A & P, %1 : $A & P):
94
94
// We want to make sure that we picked up on the FIRST store and not the second one.
95
95
// class C's foo method is named "bar" whereas class B's foo method is named "foo".
96
96
// We want to make sure that we call a function named "foo" not "bar".
97
- // CHECK: [[FN:%[0-9]+]] = function_ref @${{.*}}foo{{.*}} : $@convention(thin) () -> Int
98
- %7 = witness_method $@opened("A1F1B526-1463-11EA-932F-ACBC329C418B") A & P, #P.foo!1 : <Self where Self : P> (Self) -> () -> Int , %2 : $@opened("A1F1B526-1463-11EA-932F-ACBC329C418B") A & P : $@convention(witness_method: P) <τ_0_0 where τ_0_0 : P> (@in_guaranteed τ_0_0) -> Int
97
+ // CHECK: [[FN:%[0-9]+]] = function_ref @${{.*}}foo{{.*}} : $@convention(thin) () -> Int64
98
+ %7 = witness_method $@opened("A1F1B526-1463-11EA-932F-ACBC329C418B") A & P, #P.foo!1 : <Self where Self : P> (Self) -> () -> Int64 , %2 : $@opened("A1F1B526-1463-11EA-932F-ACBC329C418B") A & P : $@convention(witness_method: P) <τ_0_0 where τ_0_0 : P> (@in_guaranteed τ_0_0) -> Int64
99
99
// CHECK: apply [[FN]]
100
- %8 = apply %7<@opened("A1F1B526-1463-11EA-932F-ACBC329C418B") A & P>(%5) : $@convention(witness_method: P) <τ_0_0 where τ_0_0 : P> (@in_guaranteed τ_0_0) -> Int
100
+ %8 = apply %7<@opened("A1F1B526-1463-11EA-932F-ACBC329C418B") A & P>(%5) : $@convention(witness_method: P) <τ_0_0 where τ_0_0 : P> (@in_guaranteed τ_0_0) -> Int64
101
101
102
102
store %3 to %5 : $*@opened("A1F1B526-1463-11EA-932F-ACBC329C418B") A & P
103
103
dealloc_stack %5 : $*@opened("A1F1B526-1463-11EA-932F-ACBC329C418B") A & P
104
- return %8 : $Int
104
+ return %8 : $Int64
105
105
// CHECK-LABEL: end sil function {{.*}}impl{{.*}}
106
106
} // end sil function 'impl'
107
107
108
108
// C.foo()
109
- sil @bar : $@convention(method) (@guaranteed C) -> Int
109
+ sil @bar : $@convention(method) (@guaranteed C) -> Int64
110
110
111
111
sil_vtable [serialized] B {
112
- #B.foo!1: (B) -> () -> Int : @foo // B.foo()
112
+ #B.foo!1: (B) -> () -> Int64 : @foo // B.foo()
113
113
}
114
114
115
115
sil_vtable [serialized] C {
116
- #C.foo!1: (C) -> () -> Int : @bar
116
+ #C.foo!1: (C) -> () -> Int64 : @bar
117
117
}
118
118
119
119
sil_witness_table [serialized] B: P module run {
120
- method #P.foo!1: <Self where Self : P> (Self) -> () -> Int : @Pfoo // protocol witness for P.foo() in conformance B
120
+ method #P.foo!1: <Self where Self : P> (Self) -> () -> Int64 : @Pfoo // protocol witness for P.foo() in conformance B
121
121
}
0 commit comments