mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
cross-module-optimization: be more conservative with references to non-public functions
We need to make serializing shared functions more robust. Until then, be more conservative with non-public functions.
This commit is contained in:
@@ -248,6 +248,12 @@ bool CrossModuleOptimization::canSerializeInstruction(SILInstruction *inst,
|
|||||||
if (!callee)
|
if (!callee)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
// In conservative mode we don't want to turn non-public functions into
|
||||||
|
// public functions, because that can increase code size. E.g. if the
|
||||||
|
// function is completely inlined afterwards.
|
||||||
|
if (conservative && !hasPublicVisibility(callee->getLinkage()))
|
||||||
|
return false;
|
||||||
|
|
||||||
// Recursivly walk down the call graph.
|
// Recursivly walk down the call graph.
|
||||||
if (canSerializeFunction(callee, canSerializeFlags, maxDepth - 1))
|
if (canSerializeFunction(callee, canSerializeFlags, maxDepth - 1))
|
||||||
return true;
|
return true;
|
||||||
@@ -260,12 +266,6 @@ bool CrossModuleOptimization::canSerializeInstruction(SILInstruction *inst,
|
|||||||
if (!canUseFromInline(callee))
|
if (!canUseFromInline(callee))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// In conservative mode we don't want to turn non-public functions into
|
|
||||||
// public functions, because that can increase code size. E.g. if the
|
|
||||||
// function is completely inlined afterwards.
|
|
||||||
if (conservative && callee->getLinkage() != SILLinkage::Public)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (auto *GAI = dyn_cast<GlobalAddrInst>(inst)) {
|
if (auto *GAI = dyn_cast<GlobalAddrInst>(inst)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user