@@ -129,9 +129,30 @@ static void addMandatoryDiagnosticOptPipeline(SILPassPipelinePlan &P) {
129
129
P.addNoReturnFolding ();
130
130
addDefiniteInitialization (P);
131
131
132
+ P.addAddressLowering ();
133
+
134
+ P.addFlowIsolation ();
135
+
136
+ // Automatic differentiation: canonicalize all differentiability witnesses
137
+ // and `differentiable_function` instructions.
138
+ P.addDifferentiation ();
139
+
140
+ // Only run semantic arc opts if we are optimizing and if mandatory semantic
141
+ // arc opts is explicitly enabled.
142
+ //
143
+ // NOTE: Eventually this pass will be split into a mandatory/more aggressive
144
+ // pass. This will happen when OSSA is no longer eliminated before the
145
+ // optimizer pipeline is run implying we can put a pass that requires OSSA
146
+ // there.
147
+ const auto &Options = P.getOptions ();
148
+ P.addClosureLifetimeFixup ();
149
+
132
150
// ===---
133
151
// Begin Ownership Optimizations
134
152
//
153
+ // These happen after ClosureLifetimeFixup because they depend on the
154
+ // resolution of nonescaping closure lifetimes to correctly check the use
155
+ // of move-only values as captures in nonescaping closures as borrows.
135
156
136
157
// Check noImplicitCopy and move only types for addresses.
137
158
P.addMoveOnlyAddressChecker ();
@@ -150,24 +171,6 @@ static void addMandatoryDiagnosticOptPipeline(SILPassPipelinePlan &P) {
150
171
// End Ownership Optimizations
151
172
// ===---
152
173
153
- P.addAddressLowering ();
154
-
155
- P.addFlowIsolation ();
156
-
157
- // Automatic differentiation: canonicalize all differentiability witnesses
158
- // and `differentiable_function` instructions.
159
- P.addDifferentiation ();
160
-
161
- // Only run semantic arc opts if we are optimizing and if mandatory semantic
162
- // arc opts is explicitly enabled.
163
- //
164
- // NOTE: Eventually this pass will be split into a mandatory/more aggressive
165
- // pass. This will happen when OSSA is no longer eliminated before the
166
- // optimizer pipeline is run implying we can put a pass that requires OSSA
167
- // there.
168
- const auto &Options = P.getOptions ();
169
- P.addClosureLifetimeFixup ();
170
-
171
174
#ifndef NDEBUG
172
175
// Add a verification pass to check our work when skipping
173
176
// function bodies.
0 commit comments