New implementation of dead function elimination, which includes dead method elimination.

If vtable or witness methods are never called, e.g. because they are completely devirtualized,
then they are removed from the tables and eliminated.

Another improvement of the new algorithm is that it is able to eliminate dead function cycles
(e.g. A() calls B() and vice versa).



Swift SVN r22969
This commit is contained in:
Erik Eckstein
2014-10-27 16:41:02 +00:00
parent f82dbb8176
commit f40f3a93a0
8 changed files with 386 additions and 56 deletions

View File

@@ -140,7 +140,7 @@ void SILWitnessTable::convertToDefinition(ArrayRef<Entry> entries,
void *buf = Mod.allocate(sizeof(Entry)*entries.size(), alignof(Entry));
memcpy(buf, entries.begin(), sizeof(Entry)*entries.size());
Entries = ArrayRef<Entry>(static_cast<Entry*>(buf), entries.size());
Entries = MutableArrayRef<Entry>(static_cast<Entry*>(buf), entries.size());
// Bump the reference count of witness functions referenced by this table.
for (auto entry : getEntries()) {