Skip to content

Commit 2ac1f8a

Browse files
committed
SIL Linker: Deserialize HiddenExternal functions
PublicNonABI function declarations deserialize as HiddenExternal, then become SharedExternal after the body has been deserialized. So try deserializing HiddenExternal too. NFC until mandatory inlining is no longer eagerly deserializing.
1 parent d520d03 commit 2ac1f8a

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

lib/SIL/Linker.cpp

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,21 @@ bool SILLinkerVisitor::maybeAddFunctionToWorklist(SILFunction *F) {
5858
if (!F->isExternalDeclaration())
5959
return false;
6060

61-
if (isLinkAll() || hasSharedVisibility(F->getLinkage()))
61+
// In the performance pipeline, we deserialize all reachable functions.
62+
if (isLinkAll())
63+
return addFunctionToWorklist(F);
64+
65+
// Otherwise, make sure to deserialize shared functions; we need to
66+
// emit them into the client binary since they're not available
67+
// externally.
68+
if (hasSharedVisibility(F->getLinkage()))
69+
return addFunctionToWorklist(F);
70+
71+
// Functions with PublicNonABI linkage are deserialized as having
72+
// HiddenExternal linkage when they are declarations, then they
73+
// become SharedExternal after the body has been deserialized.
74+
// So try deserializing HiddenExternal functions too.
75+
if (F->getLinkage() == SILLinkage::HiddenExternal)
6276
return addFunctionToWorklist(F);
6377

6478
return false;

0 commit comments

Comments
 (0)