Skip to content

Commit 3579402

Browse files
committed
Clean up formatting for IRGen super_method tests
- Remove autogenerated comments - Use phony unmangled names for better readability
1 parent fbbb593 commit 3579402

File tree

2 files changed

+33
-41
lines changed

2 files changed

+33
-41
lines changed

test/IRGen/super_class_method.sil

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -18,45 +18,41 @@ public class Grandchild : Child {
1818
}
1919
}
2020

21-
// static test2.Parent.foo () -> ()
22-
sil @_TZFC5test26Parent3foofT_T_ : $@convention(thin) (@thick Parent.Type) -> () {
23-
// %0 // user: %1
21+
sil @Parent_foo : $@convention(thin) (@thick Parent.Type) -> () {
2422
bb0(%0 : $@thick Parent.Type):
25-
debug_value %0 : $@thick Parent.Type // let self // id: %1
26-
%2 = tuple () // user: %3
27-
return %2 : $() // id: %3
23+
debug_value %0 : $@thick Parent.Type
24+
%2 = tuple ()
25+
return %2 : $()
2826
}
2927

30-
// static test2.Grandchild.foo () -> ()
31-
sil @_TZFC5test210Grandchild3foofT_T_ : $@convention(thin) (@thick Grandchild.Type) -> () {
32-
// %0 // users: %1, %2
28+
sil @Grandchild_foo : $@convention(thin) (@thick Grandchild.Type) -> () {
3329
bb0(%0 : $@thick Grandchild.Type):
34-
debug_value %0 : $@thick Grandchild.Type // let self // id: %1
35-
%2 = upcast %0 : $@thick Grandchild.Type to $@thick Child.Type // user: %3
36-
%3 = upcast %2 : $@thick Child.Type to $@thick Parent.Type // user: %5
37-
%4 = super_method %0 : $@thick Grandchild.Type, #Parent.foo!1 : (Parent.Type) -> () -> (), $@convention(thin) (@thick Parent.Type) -> () // user: %5
30+
debug_value %0 : $@thick Grandchild.Type
31+
%2 = upcast %0 : $@thick Grandchild.Type to $@thick Child.Type
32+
%3 = upcast %2 : $@thick Child.Type to $@thick Parent.Type
33+
%4 = super_method %0 : $@thick Grandchild.Type, #Parent.foo!1 : (Parent.Type) -> () -> (), $@convention(thin) (@thick Parent.Type) -> ()
3834
%5 = apply %4(%3) : $@convention(thin) (@thick Parent.Type) -> ()
39-
%6 = tuple () // user: %7
40-
return %6 : $() // id: %7
35+
%6 = tuple ()
36+
return %6 : $()
4137
}
4238

4339
sil_vtable Parent {
44-
#Parent.foo!1: _TZFC5test26Parent3foofT_T_ // static test2.Parent.foo () -> ()
40+
#Parent.foo!1: Parent_foo
4541
}
4642

4743
sil_vtable Child {
48-
#Parent.foo!1: _TZFC5test26Parent3foofT_T_ // static test2.Parent.foo () -> ()
44+
#Parent.foo!1: Parent_foo
4945
}
5046

5147
sil_vtable Grandchild {
52-
#Parent.foo!1: _TZFC5test210Grandchild3foofT_T_ // static test2.Grandchild.foo () -> ()
48+
#Parent.foo!1: Grandchild_foo
5349
}
5450

55-
56-
// CHECK-LABEL: define void @_TZFC5test210Grandchild3foofT_T_(%swift.type*) #0
51+
// CHECK-LABEL: define void @Grandchild_foo(%swift.type*) #0
5752
// CHECK: [[OPAQUE_GRANDCHILD:%[0-9]+]] = bitcast %swift.type* %0 to %swift.type**
5853
// CHECK: [[SUPER_METADATA_PTR:%[0-9]+]] = getelementptr inbounds %swift.type*, %swift.type** [[OPAQUE_GRANDCHILD]], i32 1
5954
// CHECK: [[SUPER_METADATA:%[0-9]+]] = load %swift.type*, %swift.type** [[SUPER_METADATA_PTR]]
6055
// CHECK: [[FOO_VTABLE_SLOT:%[0-9]+]] = getelementptr inbounds void (%swift.type*)*, void (%swift.type*)**
6156
// CHECK: [[FOO_FNPTR:%[0-9]+]] = load void (%swift.type*)*, void (%swift.type*)** [[FOO_VTABLE_SLOT]]
6257
// CHECK: call void
58+

test/IRGen/super_instance_method.sil

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -16,44 +16,39 @@ public class Grandchild : Child {
1616
override public func foo() { super.foo() }
1717
}
1818

19-
// test.Parent.foo () -> ()
20-
sil @_TFC4test6Parent3foofT_T_ : $@convention(method) (@guaranteed Parent) -> () {
21-
// %0 // user: %1
19+
sil @Parent_foo : $@convention(method) (@guaranteed Parent) -> () {
2220
bb0(%0 : $Parent):
23-
debug_value %0 : $Parent // let self // id: %1
24-
%2 = tuple () // user: %3
25-
return %2 : $() // id: %3
21+
debug_value %0 : $Parent
22+
%2 = tuple ()
23+
return %2 : $()
2624
}
2725

28-
// test.Grandchild.foo () -> ()
29-
sil @_TFC4test10Grandchild3foofT_T_ : $@convention(method) (@guaranteed Grandchild) -> () {
30-
// %0 // users: %1, %2, %3
26+
sil @Grandchild_foo : $@convention(method) (@guaranteed Grandchild) -> () {
3127
bb0(%0 : $Grandchild):
32-
debug_value %0 : $Grandchild // let self // id: %1
33-
strong_retain %0 : $Grandchild // id: %2
34-
%3 = upcast %0 : $Grandchild to $Child // user: %4
35-
%4 = upcast %3 : $Child to $Parent // users: %6, %7
36-
// function_ref test.Parent.foo () -> ()
28+
debug_value %0 : $Grandchild
29+
strong_retain %0 : $Grandchild
30+
%3 = upcast %0 : $Grandchild to $Child
31+
%4 = upcast %3 : $Child to $Parent
3732
%5 = super_method %0 : $Grandchild, #Parent.foo!1 : (Parent) -> () -> (), $@convention(method) (@guaranteed Parent) -> ()
3833
%6 = apply %5(%4) : $@convention(method) (@guaranteed Parent) -> ()
39-
strong_release %4 : $Parent // id: %7
40-
%8 = tuple () // user: %9
41-
return %8 : $() // id: %9
34+
strong_release %4 : $Parent
35+
%8 = tuple ()
36+
return %8 : $()
4237
}
4338

4439
sil_vtable Parent {
45-
#Parent.foo!1: _TFC4test6Parent3foofT_T_ // test.Parent.foo () -> ()
40+
#Parent.foo!1: Parent_foo
4641
}
4742

4843
sil_vtable Child {
49-
#Parent.foo!1: _TFC4test6Parent3foofT_T_ // test.Parent.foo () -> ()
44+
#Parent.foo!1: Parent_foo
5045
}
5146

5247
sil_vtable Grandchild {
53-
#Parent.foo!1: _TFC4test10Grandchild3foofT_T_ // test.Grandchild.foo () -> ()
48+
#Parent.foo!1: Grandchild_foo
5449
}
5550

56-
// CHECK: define void @_TFC4test10Grandchild3foofT_T_(%C21super_instance_method10Grandchild*)
51+
// CHECK: define void @Grandchild_foo(%C21super_instance_method10Grandchild*)
5752
// CHECK: [[OPAQUE_GRANDCHILD:%[0-9]+]] = bitcast %C21super_instance_method10Grandchild* %0 to %swift.type**
5853
// CHECK: [[GRANDCHILD_METADATA:%\..*]] = load %swift.type*, %swift.type** [[OPAQUE_GRANDCHILD]]
5954
// CHECK: [[OPAQUE_METADATA:%[0-9]+]] = bitcast %swift.type* [[GRANDCHILD_METADATA]] to %swift.type**
@@ -62,3 +57,4 @@ sil_vtable Grandchild {
6257
// CHECK: [[FOO_VTABLE_SLOT:%[0-9]+]] = getelementptr inbounds void (%C21super_instance_method6Parent*)*, void (%C21super_instance_method6Parent*)**
6358
// CHECK: [[FOO_FNPTR:%[0-9]+]] = load void (%C21super_instance_method6Parent*)*, void (%C21super_instance_method6Parent*)** [[FOO_VTABLE_SLOT]]
6459
// CHECK: call void
60+

0 commit comments

Comments
 (0)