[linker] Link in closures references via function_refs during mandatory inlining.

Pattern matching on whether or not the function was applied is fragile
in the face of various possible compositions in between the function_ref
and the apply (i.e. thin_to_thick_function as an example).

Lets be conservative and just always deserialize references to closures
during mandatory inlining when referenced via a function_ref so we avoid
this problem if additional instructions like this are added.

Swift SVN r17977
This commit is contained in:
Michael Gottesman
2014-05-12 23:59:48 +00:00
parent 9c0bd85e63
commit e5191519e6

View File

@@ -447,7 +447,12 @@ public:
}
bool visitFunctionRefInst(FunctionRefInst *FRI) {
if (!isLinkAll())
// Needed to handle closures which are no longer applied, but are left
// behind as dead code. This shouldn't happen, but if it does don't get into
// an inconsistent state.
SILFunction *Callee = FRI->getReferencedFunction();
if (!isLinkAll() && !Callee->isTransparent() &&
Callee->getLinkage() != SILLinkage::Shared)
return false;
addFunctionToWorklist(FRI->getReferencedFunction());