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

@@ -139,7 +139,7 @@ SILVTable *SILLinkerVisitor::processClassDecl(const ClassDecl *C) {
// Otherwise, add all the vtable functions in Vtbl to the function
// processing list...
for (auto &E : Vtbl->getEntries())
Worklist.push_back(E.second);
Worklist.push_back(E.Implementation);
// And then transitively deserialize all SIL referenced by those functions.
process();
@@ -162,9 +162,9 @@ bool SILLinkerVisitor::linkInVTable(ClassDecl *D) {
// for processing.
bool Result = false;
for (auto P : Vtbl->getEntries()) {
if (P.second->isExternalDeclaration()) {
if (P.Implementation->isExternalDeclaration()) {
Result = true;
addFunctionToWorklist(P.second);
addFunctionToWorklist(P.Implementation);
}
}
return Result;