Skip to content

Commit 6765708

Browse files
committed
Lower OwnershipModelEliminator to just before inlining
1 parent b74e4a2 commit 6765708

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

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-
440424
addSimplifyCFGSILCombinePasses(P);
441425

442426
P.addArrayElementPropagation();
@@ -481,13 +465,21 @@ void addFunctionPasses(SILPassPipelinePlan &P,
481465
}
482466
P.addARCSequenceOpts();
483467

484-
if (P.getOptions().EnableOSSAModules) {
485-
// We earlier eliminated ownership if we are not compiling the stdlib. Now
486-
// handle the stdlib functions, re-simplifying, eliminating ARC as we do.
487-
if (P.getOptions().CopyPropagation != CopyPropagationOption::Off) {
488-
P.addCopyPropagation();
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();
472+
}
473+
P.addSemanticARCOpts();
474+
475+
if (!P.getOptions().EnableOSSAModules) {
476+
if (P.getOptions().StopOptimizationBeforeLoweringOwnership)
477+
return;
478+
479+
if (SILPrintFinalOSSAModule) {
480+
addModulePrinterPipeline(P, "SIL Print Final OSSA Module");
489481
}
490-
P.addSemanticARCOpts();
482+
P.addNonTransparentFunctionOwnershipModelEliminator();
491483
}
492484

493485
switch (OpLevel) {
@@ -616,16 +608,6 @@ static void addPerfEarlyModulePassPipeline(SILPassPipelinePlan &P) {
616608
// not blocked by any other passes' optimizations, so do it early.
617609
P.addDifferentiabilityWitnessDevirtualizer();
618610

619-
if (!P.getOptions().EnableOSSAModules && SILDisableLateOMEByDefault) {
620-
if (P.getOptions().StopOptimizationBeforeLoweringOwnership)
621-
return;
622-
623-
if (SILPrintFinalOSSAModule) {
624-
addModulePrinterPipeline(P, "SIL Print Final OSSA Module");
625-
}
626-
P.addNonTransparentFunctionOwnershipModelEliminator();
627-
}
628-
629611
// Start by linking in referenced functions from other modules.
630612
P.addPerformanceSILLinker();
631613

0 commit comments

Comments
 (0)