Update the zombie function list if we create new functions

Dead function elimination deletes functions making them zombies. A zombie is a
function whose name only exists because debug info might still refer to it.

However, later passes of specialization might create a new function by the same
name again. We now have a zombie function (which is just an alias to a deleted
method stub) and a function definition.

No test case since I could not reduce this to a small test case.

rdar://24659988
This commit is contained in:
Arnold Schwaighofer
2016-02-15 12:14:52 -08:00
parent 1e2285935f
commit 525f8ecbe1
3 changed files with 16 additions and 0 deletions

View File

@@ -512,6 +512,13 @@ void SILModule::invalidateSILLoaderCaches() {
getSILLoader()->invalidateCaches();
}
void SILModule::removeFromZombieList(StringRef Name) {
if (auto *Zombie = ZombieFunctionTable.lookup(Name)) {
ZombieFunctionTable.erase(Name);
zombieFunctions.remove(Zombie);
}
}
/// Erase a function from the module.
void SILModule::eraseFunction(SILFunction *F) {
@@ -529,6 +536,7 @@ void SILModule::eraseFunction(SILFunction *F) {
// or vtable stub generation. So we move it into the zombie list.
getFunctionList().remove(F);
zombieFunctions.push_back(F);
ZombieFunctionTable[copiedName] = F;
F->setZombie();
// This opens dead-function-removal opportunities for called functions.