Skip to content

Commit 79cc654

Browse files
committed
Lower OwnershipModelEliminator to just before inlining
1 parent 8e2aa52 commit 79cc654

File tree

1 file changed

+14
-32
lines changed

1 file changed

+14
-32
lines changed

lib/SILOptimizer/PassManager/PassPipeline.cpp

Lines changed: 14 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,6 @@ static llvm::cl::opt<bool> SILViewSILGenCFG(
6161
"sil-view-silgen-cfg", llvm::cl::init(false),
6262
llvm::cl::desc("Enable the sil cfg viewer pass before diagnostics"));
6363

64-
65-
llvm::cl::opt<bool> SILDisableLateOMEByDefault(
66-
"sil-disable-late-ome-by-default", llvm::cl::init(false),
67-
llvm::cl::desc(
68-
"Disable late OME for non-transparent functions by default"));
69-
7064
llvm::cl::opt<bool>
7165
EnableDestroyHoisting("enable-destroy-hoisting", llvm::cl::init(false),
7266
llvm::cl::desc("Enable the DestroyHoisting pass."));
@@ -452,16 +446,6 @@ void addFunctionPasses(SILPassPipelinePlan &P,
452446
// Cleanup, which is important if the inliner has restarted the pass pipeline.
453447
P.addPerformanceConstantPropagation();
454448

455-
if (!P.getOptions().EnableOSSAModules && !SILDisableLateOMEByDefault) {
456-
if (P.getOptions().StopOptimizationBeforeLoweringOwnership)
457-
return;
458-
459-
if (SILPrintFinalOSSAModule) {
460-
addModulePrinterPipeline(P, "SIL Print Final OSSA Module");
461-
}
462-
P.addNonTransparentFunctionOwnershipModelEliminator();
463-
}
464-
465449
addSimplifyCFGSILCombinePasses(P);
466450

467451
P.addArrayElementPropagation();
@@ -506,13 +490,21 @@ void addFunctionPasses(SILPassPipelinePlan &P,
506490
}
507491
P.addARCSequenceOpts();
508492

509-
if (P.getOptions().EnableOSSAModules) {
510-
// We earlier eliminated ownership if we are not compiling the stdlib. Now
511-
// handle the stdlib functions, re-simplifying, eliminating ARC as we do.
512-
if (P.getOptions().CopyPropagation != CopyPropagationOption::Off) {
513-
P.addCopyPropagation();
493+
// We earlier eliminated ownership if we are not compiling the stdlib. Now
494+
// handle the stdlib functions, re-simplifying, eliminating ARC as we do.
495+
if (P.getOptions().CopyPropagation != CopyPropagationOption::Off) {
496+
P.addCopyPropagation();
497+
}
498+
P.addSemanticARCOpts();
499+
500+
if (!P.getOptions().EnableOSSAModules) {
501+
if (P.getOptions().StopOptimizationBeforeLoweringOwnership)
502+
return;
503+
504+
if (SILPrintFinalOSSAModule) {
505+
addModulePrinterPipeline(P, "SIL Print Final OSSA Module");
514506
}
515-
P.addSemanticARCOpts();
507+
P.addNonTransparentFunctionOwnershipModelEliminator();
516508
}
517509

518510
switch (OpLevel) {
@@ -641,16 +633,6 @@ static void addPerfEarlyModulePassPipeline(SILPassPipelinePlan &P) {
641633
// not blocked by any other passes' optimizations, so do it early.
642634
P.addDifferentiabilityWitnessDevirtualizer();
643635

644-
if (!P.getOptions().EnableOSSAModules && SILDisableLateOMEByDefault) {
645-
if (P.getOptions().StopOptimizationBeforeLoweringOwnership)
646-
return;
647-
648-
if (SILPrintFinalOSSAModule) {
649-
addModulePrinterPipeline(P, "SIL Print Final OSSA Module");
650-
}
651-
P.addNonTransparentFunctionOwnershipModelEliminator();
652-
}
653-
654636
// Start by linking in referenced functions from other modules.
655637
P.addPerformanceSILLinker();
656638

0 commit comments

Comments
 (0)