DeadFunctionElimination: don’t eliminate public methods which are called via a thunk.

For this we need to store the linkage of the “original” method implementation in the vtable.
Otherwise DeadFunctionElimination thinks that the method implementation is not public but private (which is the linkage of the thunk).

The big part of this change is to extend SILVTable to store the linkage (+ serialization, printing, etc.).

fixes rdar://problem/29841635
This commit is contained in:
Erik Eckstein
2017-01-06 15:36:18 -08:00
parent 7d427aa62e
commit 1eb3a0532b
20 changed files with 193 additions and 112 deletions

View File

@@ -1569,10 +1569,12 @@ bb0(%0 : $Builtin.RawPointer, %1 : $Builtin.Word):
}
// CHECK-LABEL: sil_vtable Foo {
// CHECK: #Foo.subscript!getter.1: _TFC3tmp3Foog9subscriptFTVs5Int32S1__S1_
// CHECK: #Foo.subscript!getter.1: hidden _TFC3tmp3Foog9subscriptFTVs5Int32S1__S1_
// CHECK: #Foo.subscript!setter.1: _TFC3tmp3Foos9subscriptFTVs5Int32S1__S1_
// CHECK: }
sil_vtable Foo {
#Foo.subscript!getter.1: _TFC3tmp3Foog9subscriptFTVs5Int32S1__S1_
#Foo.subscript!setter.1: _TFC3tmp3Foos9subscriptFTVs5Int32S1__S1_
// Override the linke to check if it is parsed correctly.
#Foo.subscript!getter.1: hidden _TFC3tmp3Foog9subscriptFTVs5Int32S1__S1_
// The public linkage is the same as the function's linkage and should not be printed.
#Foo.subscript!setter.1: public _TFC3tmp3Foos9subscriptFTVs5Int32S1__S1_
}