@@ -95,8 +95,6 @@ class DeadFunctionAndGlobalElimination {
95
95
96
96
bool keepExternalWitnessTablesAlive;
97
97
98
- bool removeUnspecializedFunctionsInEmbeddedSwift;
99
-
100
98
// / Checks is a function is alive, e.g. because it is visible externally.
101
99
bool isAnchorFunction (SILFunction *F) {
102
100
@@ -433,8 +431,9 @@ class DeadFunctionAndGlobalElimination {
433
431
// externally and are not anchors.
434
432
bool embedded = Module->getOptions ().EmbeddedSwift ;
435
433
bool generic = loweredFunctionHasGenericArguments (&F);
434
+ bool isSerialized = Module->isSerialized ();
436
435
bool ignoreAnchor =
437
- embedded && generic && removeUnspecializedFunctionsInEmbeddedSwift ;
436
+ embedded && generic && isSerialized ;
438
437
439
438
if (isAnchorFunction (&F) && !ignoreAnchor) {
440
439
LLVM_DEBUG (llvm::dbgs () << " anchor function: " << F.getName () <<" \n " );
@@ -706,16 +705,13 @@ class DeadFunctionAndGlobalElimination {
706
705
}
707
706
708
707
public:
709
- DeadFunctionAndGlobalElimination (
710
- SILModule *module , bool keepExternalWitnessTablesAlive,
711
- bool removeUnspecializedFunctionsInEmbeddedSwift)
712
- : Module(module ),
713
- keepExternalWitnessTablesAlive (keepExternalWitnessTablesAlive),
714
- removeUnspecializedFunctionsInEmbeddedSwift(
715
- removeUnspecializedFunctionsInEmbeddedSwift) {}
708
+ DeadFunctionAndGlobalElimination (SILModule *module ,
709
+ bool keepExternalWitnessTablesAlive) :
710
+ Module (module ),
711
+ keepExternalWitnessTablesAlive (keepExternalWitnessTablesAlive) {}
716
712
717
- // / The main entry point of the optimization.
718
- void eliminateFunctionsAndGlobals (SILModuleTransform *DFEPass) {
713
+ // / The main entry point of the optimization.
714
+ void eliminateFunctionsAndGlobals (SILModuleTransform *DFEPass) {
719
715
720
716
LLVM_DEBUG (llvm::dbgs () << " running dead function elimination\n " );
721
717
findAliveFunctions ();
@@ -796,10 +792,8 @@ class DeadFunctionAndGlobalEliminationPass : public SILModuleTransform {
796
792
// can eliminate such functions.
797
793
getModule ()->invalidateSILLoaderCaches ();
798
794
799
- DeadFunctionAndGlobalElimination deadFunctionElimination (
800
- getModule (),
801
- /* keepExternalWitnessTablesAlive*/ !isLateDFE,
802
- /* removeUnspecializedFunctionsInEmbeddedSwift*/ isLateDFE);
795
+ DeadFunctionAndGlobalElimination deadFunctionElimination (getModule (),
796
+ /* keepExternalWitnessTablesAlive*/ !isLateDFE);
803
797
deadFunctionElimination.eliminateFunctionsAndGlobals (this );
804
798
}
805
799
};
0 commit comments