mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[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:
@@ -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());
|
||||
|
||||
Reference in New Issue
Block a user