Skip to content

[arc] Change guaranteed arc opts to be based on SemanticARCOpts and move from Diagnostic pipeline -> Onone pipeline. #32390

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion lib/SILOptimizer/Mandatory/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ target_sources(swiftSILOptimizer PRIVATE
DiagnoseStaticExclusivity.cpp
DiagnoseUnreachable.cpp
Differentiation.cpp
GuaranteedARCOpts.cpp
IRGenPrepare.cpp
MandatoryInlining.cpp
PredictableMemOpt.cpp
Expand Down
260 changes: 0 additions & 260 deletions lib/SILOptimizer/Mandatory/GuaranteedARCOpts.cpp

This file was deleted.

21 changes: 16 additions & 5 deletions lib/SILOptimizer/PassManager/PassPipeline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,15 @@ static void addDefiniteInitialization(SILPassPipelinePlan &P) {
P.addRawSILInstLowering();
}

static void addMandatoryOptPipeline(SILPassPipelinePlan &P) {
P.startPipeline("Guaranteed Passes");
// This pipeline defines a set of mandatory diagnostic passes and a set of
// supporting optimization passes that enable those diagnostics. These are run
// before any performance optimizations and in contrast to those optimizations
// _IS_ run when SourceKit emits diagnostics.
//
// Any passes not needed for diagnostic emission that need to run at -Onone
// should be in the -Onone pass pipeline and the prepare optimizations pipeline.
static void addMandatoryDiagnosticOptPipeline(SILPassPipelinePlan &P) {
P.startPipeline("Mandatory Diagnostic Passes + Enabling Optimization Passes");
P.addSILGenCleanup();
P.addDiagnoseInvalidEscapingCaptures();
P.addDiagnoseStaticExclusivity();
Expand Down Expand Up @@ -142,7 +149,6 @@ static void addMandatoryOptPipeline(SILPassPipelinePlan &P) {
// dead allocations.
P.addPredictableDeadAllocationElimination();

P.addGuaranteedARCOpts();
P.addDiagnoseUnreachable();
P.addDiagnoseInfiniteRecursion();
P.addYieldOnceCheck();
Expand All @@ -169,7 +175,7 @@ SILPassPipelinePlan::getDiagnosticPassPipeline(const SILOptions &Options) {
}

// Otherwise run the rest of diagnostics.
addMandatoryOptPipeline(P);
addMandatoryDiagnosticOptPipeline(P);

if (SILViewGuaranteedCFG) {
addCFGPrinterPipeline(P, "SIL View Guaranteed CFG");
Expand Down Expand Up @@ -738,9 +744,14 @@ SILPassPipelinePlan
SILPassPipelinePlan::getOnonePassPipeline(const SILOptions &Options) {
SILPassPipelinePlan P(Options);

P.startPipeline("Mandatory Combines");
// These are optimizations that we do not need to enable diagnostics (or
// depend on other passes needed for diagnostics). Thus we can run them later
// and avoid having SourceKit run these passes when just emitting diagnostics
// in the editor.
P.startPipeline("non-Diagnostic Enabling Mandatory Optimizations");
P.addForEachLoopUnroll();
P.addMandatoryCombine();
P.addGuaranteedARCOpts();

// First serialize the SIL if we are asked to.
P.startPipeline("Serialization");
Expand Down
Loading