[SIL] Don’t create witness table entries for overriding requirements.

SIL will not generate calls to protocol requirements that override
other protocol requirements, so all of the witness table entries for
the overriding arguments are dynamically dead. Remove them from the
witness tables entirely.

Implements rdar://problem/43870489, reducing the size of the standard
library binary by 196k.
This commit is contained in:
Doug Gregor
2018-09-05 13:49:28 -07:00
parent 0cdede2bdf
commit c7152f3576
7 changed files with 80 additions and 12 deletions

View File

@@ -721,7 +721,11 @@ bool SILDeclRef::requiresNewVTableEntry() const {
}
bool SILDeclRef::requiresNewWitnessTableEntry() const {
return cast<AbstractFunctionDecl>(getDecl())->getOverriddenDecls().empty();
return requiresNewWitnessTableEntry(cast<AbstractFunctionDecl>(getDecl()));
}
bool SILDeclRef::requiresNewWitnessTableEntry(AbstractFunctionDecl *func) {
return func->getOverriddenDecls().empty();
}
SILDeclRef SILDeclRef::getOverridden() const {