Make it possible to mark SILFunction as referenced by metainformation

This marker can be used e.g. when a function is referenced from the generic specialization information (or any other kind of metadata) to indicate that this SIL function should not be completely eliminated by the dead function elimination pass even if it is not referenced by any function_ref instruction anymore. Such a function will be preserved in a zombie list instead if it needs to be eliminated.
This commit is contained in:
Roman Levenstein
2017-07-28 15:56:16 -07:00
parent a73fbdb3fe
commit 6b5aced3b9
2 changed files with 23 additions and 4 deletions

View File

@@ -557,8 +557,9 @@ void SILModule::removeFromZombieList(StringRef Name) {
void SILModule::eraseFunction(SILFunction *F) {
assert(! F->isZombie() && "zombie function is in list of alive functions");
if (F->isInlined() || F->isExternallyUsedSymbol()) {
if (F->isInlined() || F->isExternallyUsedSymbol() ||
F->isReferencedByMetainformation()) {
// The owner of the function's Name is the FunctionTable key. As we remove
// the function from the table we have to store the name string elsewhere:
// in zombieFunctionNames.