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> {
61
61
62
62
NominalTypeDecl *getNominalDecl () const { return nominalDecl; }
63
63
64
- SILFunction *getImplementation () const { return funcImpl; }
64
+ SILFunction *getImplementation () const {
65
+ assert (funcImpl);
66
+ return funcImpl;
67
+ }
65
68
66
69
IsSerialized_t isSerialized () const {
67
70
return serialized ? IsSerialized : IsNotSerialized;
Original file line number Diff line number Diff line change @@ -71,6 +71,8 @@ class DeadFunctionAndGlobalElimination {
71
71
}
72
72
73
73
// / Adds an implementation of the method in a specific conformance.
74
+ // /
75
+ // / \p Conf is null for default implementations and move-only deinits
74
76
void addWitnessFunction (SILFunction *F, RootProtocolConformance *Conf) {
75
77
assert (isWitnessMethod);
76
78
implementingFunctions.push_back (FuncImpl (F, Conf));
@@ -618,6 +620,14 @@ class DeadFunctionAndGlobalElimination {
618
620
if (dw.getVJP ())
619
621
ensureAlive (dw.getVJP ());
620
622
}
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
+ }
621
631
}
622
632
623
633
// / Removes all dead methods from vtables and witness tables.
You can’t perform that action at this time.
0 commit comments