Skip to content

Commit 4d34d4b

Browse files
committed
Lower OwnershipModelEliminator to just before inlining
1 parent 5ced53e commit 4d34d4b

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
@@ -427,16 +427,6 @@ void addFunctionPasses(SILPassPipelinePlan &P,
427427
// Cleanup, which is important if the inliner has restarted the pass pipeline.
428428
P.addPerformanceConstantPropagation();
429429

430-
if (!P.getOptions().EnableOSSAModules && !SILDisableLateOMEByDefault) {
431-
if (P.getOptions().StopOptimizationBeforeLoweringOwnership)
432-
return;
433-
434-
if (SILPrintFinalOSSAModule) {
435-
addModulePrinterPipeline(P, "SIL Print Final OSSA Module");
436-
}
437-
P.addNonTransparentFunctionOwnershipModelEliminator();
438-
}
439-
440430
addSimplifyCFGSILCombinePasses(P);
441431

442432
P.addArrayElementPropagation();
@@ -475,14 +465,20 @@ void addFunctionPasses(SILPassPipelinePlan &P,
475465
P.addDevirtualizer();
476466
P.addARCSequenceOpts();
477467

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

487483
switch (OpLevel) {
488484
case OptimizationLevelKind::HighLevel:
@@ -610,16 +606,6 @@ static void addPerfEarlyModulePassPipeline(SILPassPipelinePlan &P) {
610606
// not blocked by any other passes' optimizations, so do it early.
611607
P.addDifferentiabilityWitnessDevirtualizer();
612608

613-
if (!P.getOptions().EnableOSSAModules && SILDisableLateOMEByDefault) {
614-
if (P.getOptions().StopOptimizationBeforeLoweringOwnership)
615-
return;
616-
617-
if (SILPrintFinalOSSAModule) {
618-
addModulePrinterPipeline(P, "SIL Print Final OSSA Module");
619-
}
620-
P.addNonTransparentFunctionOwnershipModelEliminator();
621-
}
622-
623609
// Start by linking in referenced functions from other modules.
624610
P.addPerformanceSILLinker();
625611

0 commit comments

Comments
 (0)