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));
@@ -616,6 +618,14 @@ class DeadFunctionAndGlobalElimination {
616
618
if (dw.getVJP ())
617
619
ensureAlive (dw.getVJP ());
618
620
}
621
+
622
+ // Collect move-only deinit methods.
623
+ //
624
+ // TODO: Similar to addWitnessFunction, track the associated
625
+ // struct/enum decl to allow DCE of unused deinits.
626
+ for (auto *deinit : Module->getMoveOnlyDeinits ()) {
627
+ makeAlive (deinit->getImplementation ());
628
+ }
619
629
}
620
630
621
631
// / Removes all dead methods from vtables and witness tables.
You can’t perform that action at this time.
0 commit comments