Skip to content

Commit eafb73e

Browse files
committed
Lower OwnershipModelEliminator to just before inlining
1 parent 36d333c commit eafb73e

File tree

1 file changed

+13
-27
lines changed

1 file changed

+13
-27
lines changed

lib/SILOptimizer/PassManager/PassPipeline.cpp

Lines changed: 13 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -423,16 +423,6 @@ void addFunctionPasses(SILPassPipelinePlan &P,
423423
// Cleanup, which is important if the inliner has restarted the pass pipeline.
424424
P.addPerformanceConstantPropagation();
425425

426-
if (!P.getOptions().EnableOSSAModules && !SILDisableLateOMEByDefault) {
427-
if (P.getOptions().StopOptimizationBeforeLoweringOwnership)
428-
return;
429-
430-
if (SILPrintFinalOSSAModule) {
431-
addModulePrinterPipeline(P, "SIL Print Final OSSA Module");
432-
}
433-
P.addNonTransparentFunctionOwnershipModelEliminator();
434-
}
435-
436426
addSimplifyCFGSILCombinePasses(P);
437427

438428
P.addArrayElementPropagation();
@@ -471,14 +461,20 @@ void addFunctionPasses(SILPassPipelinePlan &P,
471461
P.addDevirtualizer();
472462
P.addARCSequenceOpts();
473463

474-
if (P.getOptions().EnableOSSAModules) {
475-
// We earlier eliminated ownership if we are not compiling the stdlib. Now
476-
// handle the stdlib functions, re-simplifying, eliminating ARC as we do.
477-
if (P.getOptions().CopyPropagation != CopyPropagationOption::Off) {
478-
P.addCopyPropagation();
479-
}
480-
P.addSemanticARCOpts();
464+
// We earlier eliminated ownership if we are not compiling the stdlib. Now
465+
// handle the stdlib functions, re-simplifying, eliminating ARC as we do.
466+
if (P.getOptions().CopyPropagation != CopyPropagationOption::Off) {
467+
P.addCopyPropagation();
481468
}
469+
P.addSemanticARCOpts();
470+
471+
if (P.getOptions().StopOptimizationBeforeLoweringOwnership)
472+
return;
473+
474+
if (SILPrintFinalOSSAModule) {
475+
addModulePrinterPipeline(P, "SIL Print Final OSSA Module");
476+
}
477+
P.addNonTransparentFunctionOwnershipModelEliminator();
482478

483479
switch (OpLevel) {
484480
case OptimizationLevelKind::HighLevel:
@@ -606,16 +602,6 @@ static void addPerfEarlyModulePassPipeline(SILPassPipelinePlan &P) {
606602
// not blocked by any other passes' optimizations, so do it early.
607603
P.addDifferentiabilityWitnessDevirtualizer();
608604

609-
if (!P.getOptions().EnableOSSAModules && SILDisableLateOMEByDefault) {
610-
if (P.getOptions().StopOptimizationBeforeLoweringOwnership)
611-
return;
612-
613-
if (SILPrintFinalOSSAModule) {
614-
addModulePrinterPipeline(P, "SIL Print Final OSSA Module");
615-
}
616-
P.addNonTransparentFunctionOwnershipModelEliminator();
617-
}
618-
619605
// Start by linking in referenced functions from other modules.
620606
P.addPerformanceSILLinker();
621607

0 commit comments

Comments
 (0)