Skip to content

Commit 1bd8ca5

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 8c0f209 commit 1bd8ca5

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
@@ -55,7 +55,21 @@ void SILLinkerVisitor::maybeAddFunctionToWorklist(SILFunction *F) {
5555
if (!F->isExternalDeclaration())
5656
return;
5757

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

0 commit comments

Comments
 (0)