File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed
Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -61,7 +61,10 @@ class SILMoveOnlyDeinit final : public SILAllocated<SILMoveOnlyDeinit> {
6161
6262 NominalTypeDecl *getNominalDecl () const { return nominalDecl; }
6363
64- SILFunction *getImplementation () const { return funcImpl; }
64+ SILFunction *getImplementation () const {
65+ assert (funcImpl);
66+ return funcImpl;
67+ }
6568
6669 IsSerialized_t isSerialized () const {
6770 return serialized ? IsSerialized : IsNotSerialized;
Original file line number Diff line number Diff line change @@ -71,6 +71,8 @@ class DeadFunctionAndGlobalElimination {
7171 }
7272
7373 // / Adds an implementation of the method in a specific conformance.
74+ // /
75+ // / \p Conf is null for default implementations and move-only deinits
7476 void addWitnessFunction (SILFunction *F, RootProtocolConformance *Conf) {
7577 assert (isWitnessMethod);
7678 implementingFunctions.push_back (FuncImpl (F, Conf));
@@ -618,6 +620,14 @@ class DeadFunctionAndGlobalElimination {
618620 if (dw.getVJP ())
619621 ensureAlive (dw.getVJP ());
620622 }
623+
624+ // Collect move-only deinit methods.
625+ //
626+ // TODO: Similar to addWitnessFunction, track the associated
627+ // struct/enum decl to allow DCE of unused deinits.
628+ for (auto *deinit : Module->getMoveOnlyDeinits ()) {
629+ makeAlive (deinit->getImplementation ());
630+ }
621631 }
622632
623633 // / Removes all dead methods from vtables and witness tables.
You can’t perform that action at this time.
0 commit comments