Skip to content

Commit be5d03f

Browse files
committed
SILOptimizer: Remove witness table marking from DeadFunctionElimination
This logic was unconditionally disabled and incorrect.
1 parent ec82f6b commit be5d03f

File tree

1 file changed

+4
-26
lines changed

1 file changed

+4
-26
lines changed

lib/SILOptimizer/IPO/DeadFunctionElimination.cpp

Lines changed: 4 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -201,27 +201,13 @@ class DeadFunctionAndGlobalElimination {
201201
}
202202
} break;
203203

204-
case SILWitnessTable::AssociatedConformance: {
205-
ProtocolConformanceRef CRef =
206-
entry.getAssociatedConformanceWitness().Witness;
207-
if (CRef.isConcrete())
208-
ensureAliveConformance(CRef.getConcrete());
209-
break;
210-
}
204+
case SILWitnessTable::AssociatedConformance:
211205
case SILWitnessTable::BaseProtocol:
212-
ensureAliveConformance(entry.getBaseProtocolWitness().Witness);
213-
break;
214-
215206
case SILWitnessTable::Invalid:
216207
case SILWitnessTable::AssociatedType:
217208
break;
218209
}
219210
}
220-
221-
for (const auto &conf : WT->getConditionalConformances()) {
222-
if (conf.isConcrete())
223-
ensureAliveConformance(conf.getConcrete());
224-
}
225211
}
226212

227213
/// Marks the \p global and all functions, which are referenced from its
@@ -279,14 +265,6 @@ class DeadFunctionAndGlobalElimination {
279265
makeAlive(global);
280266
}
281267

282-
/// Marks a witness table as alive if it is not alive yet.
283-
void ensureAliveConformance(const ProtocolConformance *C) {
284-
SILWitnessTable *WT = Module->lookUpWitnessTable(C);
285-
if (!WT || isAlive(WT))
286-
return;
287-
makeAlive(WT);
288-
}
289-
290268
/// Returns true if the implementation of method \p FD in class \p ImplCl
291269
/// may be called when the type of the class_method's operand is \p MethodCl.
292270
/// Both, \p MethodCl and \p ImplCl, may by null if not known or if it's a
@@ -322,7 +300,7 @@ class DeadFunctionAndGlobalElimination {
322300
if (!isAlive(FImpl.F) &&
323301
canHaveSameImplementation(FD, MethodCl,
324302
FImpl.Impl.get<ClassDecl *>())) {
325-
makeAlive(FImpl.F);
303+
ensureAlive(FImpl.F);
326304
} else {
327305
allImplsAreCalled = false;
328306
}
@@ -341,9 +319,9 @@ class DeadFunctionAndGlobalElimination {
341319
if (auto Conf = FImpl.Impl.dyn_cast<ProtocolConformance *>()) {
342320
SILWitnessTable *WT = Module->lookUpWitnessTable(Conf);
343321
if (!WT || isAlive(WT))
344-
makeAlive(FImpl.F);
322+
ensureAlive(FImpl.F);
345323
} else {
346-
makeAlive(FImpl.F);
324+
ensureAlive(FImpl.F);
347325
}
348326
}
349327
}

0 commit comments

Comments
 (0)