@@ -515,16 +515,6 @@ void addFunctionPasses(SILPassPipelinePlan &P,
515
515
P.addSemanticARCOpts ();
516
516
P.addCopyToBorrowOptimization ();
517
517
518
- if (!P.getOptions ().EnableOSSAModules ) {
519
- if (P.getOptions ().StopOptimizationBeforeLoweringOwnership )
520
- return ;
521
-
522
- if (SILPrintFinalOSSAModule) {
523
- addModulePrinterPipeline (P, " SIL Print Final OSSA Module" );
524
- }
525
- P.addNonTransparentFunctionOwnershipModelEliminator ();
526
- }
527
-
528
518
switch (OpLevel) {
529
519
case OptimizationLevelKind::HighLevel:
530
520
// Does not inline functions with defined semantics or effects.
@@ -538,13 +528,11 @@ void addFunctionPasses(SILPassPipelinePlan &P,
538
528
}
539
529
540
530
// Clean up Semantic ARC before we perform additional post-inliner opts.
541
- if (P.getOptions ().EnableOSSAModules ) {
542
- if (P.getOptions ().CopyPropagation != CopyPropagationOption::Off) {
543
- P.addCopyPropagation ();
544
- }
545
- P.addSemanticARCOpts ();
546
- P.addCopyToBorrowOptimization ();
531
+ if (P.getOptions ().CopyPropagation != CopyPropagationOption::Off) {
532
+ P.addCopyPropagation ();
547
533
}
534
+ P.addSemanticARCOpts ();
535
+ P.addCopyToBorrowOptimization ();
548
536
549
537
// Promote stack allocations to values and eliminate redundant
550
538
// loads.
@@ -605,14 +593,12 @@ void addFunctionPasses(SILPassPipelinePlan &P,
605
593
P.addARCSequenceOpts ();
606
594
607
595
// Run a final round of ARC opts when ownership is enabled.
608
- if (P.getOptions ().EnableOSSAModules ) {
609
- P.addDestroyHoisting ();
610
- if (P.getOptions ().CopyPropagation != CopyPropagationOption::Off) {
611
- P.addCopyPropagation ();
612
- }
613
- P.addSemanticARCOpts ();
614
- P.addCopyToBorrowOptimization ();
596
+ P.addDestroyHoisting ();
597
+ if (P.getOptions ().CopyPropagation != CopyPropagationOption::Off) {
598
+ P.addCopyPropagation ();
615
599
}
600
+ P.addSemanticARCOpts ();
601
+ P.addCopyToBorrowOptimization ();
616
602
}
617
603
618
604
static void addPerfDebugSerializationPipeline (SILPassPipelinePlan &P) {
@@ -994,13 +980,11 @@ SILPassPipelinePlan::getPerformancePassPipeline(const SILOptions &Options) {
994
980
995
981
// Run one last copy propagation/semantic arc opts run before serialization/us
996
982
// lowering ownership.
997
- if (P.getOptions ().EnableOSSAModules ) {
998
- if (P.getOptions ().CopyPropagation != CopyPropagationOption::Off) {
999
- P.addCopyPropagation ();
1000
- }
1001
- P.addSemanticARCOpts ();
1002
- P.addCopyToBorrowOptimization ();
983
+ if (P.getOptions ().CopyPropagation != CopyPropagationOption::Off) {
984
+ P.addCopyPropagation ();
1003
985
}
986
+ P.addSemanticARCOpts ();
987
+ P.addCopyToBorrowOptimization ();
1004
988
1005
989
P.addCrossModuleOptimization ();
1006
990
@@ -1011,6 +995,13 @@ SILPassPipelinePlan::getPerformancePassPipeline(const SILOptions &Options) {
1011
995
// importing this module.
1012
996
P.addSerializeSILPass ();
1013
997
998
+ if (P.getOptions ().StopOptimizationBeforeLoweringOwnership )
999
+ return P;
1000
+
1001
+ if (SILPrintFinalOSSAModule) {
1002
+ addModulePrinterPipeline (P, " SIL Print Final OSSA Module" );
1003
+ }
1004
+
1014
1005
if (P.getOptions ().EnableOSSAModules && SILPrintFinalOSSAModule) {
1015
1006
addModulePrinterPipeline (P, " SIL Print Final OSSA Module" );
1016
1007
}
0 commit comments