Skip to content

Commit df638b0

Browse files
committed
[embedded] Add explaining comment for running DeadFunctionAndGlobalElimination in embedded Swift
1 parent 5b2acc7 commit df638b0

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/SILOptimizer/PassManager/PassPipeline.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,12 @@ static void addMandatoryDiagnosticOptPipeline(SILPassPipelinePlan &P) {
255255
P.addOnoneSimplification();
256256
P.addInitializeStaticGlobals();
257257

258+
// MandatoryPerformanceOptimizations might create specializations that are not
259+
// used, and by being unused they are might have unspecialized applies.
260+
// Eliminate them via the DeadFunctionAndGlobalElimination in embedded Swift
261+
// to avoid getting metadata/existential use errors in them. We don't want to
262+
// run this pass in regular Swift: Even unused functions are expected to be
263+
// available in debug (-Onone) builds for debugging and development purposes.
258264
if (P.getOptions().EmbeddedSwift) {
259265
P.addDeadFunctionAndGlobalElimination();
260266
}

0 commit comments

Comments
 (0)