@@ -128,6 +128,19 @@ static void addMandatoryDiagnosticOptPipeline(SILPassPipelinePlan &P) {
128
128
P.addAllocBoxToStack ();
129
129
P.addNoReturnFolding ();
130
130
addDefiniteInitialization (P);
131
+
132
+
133
+ // ===---
134
+ // Ownership Optimizations
135
+ //
136
+
137
+ P.addMoveKillsCopyableAddressesChecker ();
138
+ P.addMoveOnlyObjectChecker (); // Check noImplicitCopy and move only
139
+ // types.
140
+ P.addMoveKillsCopyableValuesChecker (); // No uses after _move of copyable
141
+ // value.
142
+ P.addTrivialMoveOnlyTypeEliminator ();
143
+
131
144
P.addAddressLowering ();
132
145
133
146
P.addFlowIsolation ();
@@ -159,34 +172,10 @@ static void addMandatoryDiagnosticOptPipeline(SILPassPipelinePlan &P) {
159
172
P.addMandatoryInlining ();
160
173
P.addMandatorySILLinker ();
161
174
162
- // Before we promote any loads, perform _move checking for addresses.
163
- P.addMoveKillsCopyableAddressesChecker ();
164
-
165
- // Now perform move object checking. We again do this before predictable
166
- // memory access opts to ensure that we do not get any non-source related
167
- // diagnostics due to value promotion.
168
- P.addMoveOnlyObjectChecker (); // Check noImplicitCopy and move only
169
- // types.
170
-
171
175
// Promote loads as necessary to ensure we have enough SSA formation to emit
172
176
// SSA based diagnostics.
173
177
P.addPredictableMemoryAccessOptimizations ();
174
178
175
- // Now that we have promoted simple loads for SSA based diagnostics, perform
176
- // SSA based move function checking and no implicit copy checking.
177
- P.addMoveKillsCopyableValuesChecker (); // No uses after _move of copyable
178
- // value.
179
-
180
- // Now that we have run move only checking, eliminate SILMoveOnly wrapped
181
- // trivial types from the IR. We cannot introduce extra "copies" of trivial
182
- // things so we can simplify our implementation by eliminating them here.
183
- P.addTrivialMoveOnlyTypeEliminator ();
184
-
185
- // As a temporary measure, we also eliminate move only for non-trivial types
186
- // until we can audit the later part of the pipeline. Eventually, this should
187
- // occur before IRGen.
188
- P.addMoveOnlyTypeEliminator ();
189
-
190
179
// This phase performs optimizations necessary for correct interoperation of
191
180
// Swift os log APIs with C os_log ABIs.
192
181
// Pass dependencies: this pass depends on MandatoryInlining and Mandatory
@@ -228,6 +217,11 @@ static void addMandatoryDiagnosticOptPipeline(SILPassPipelinePlan &P) {
228
217
229
218
// Canonical swift requires all non cond_br critical edges to be split.
230
219
P.addSplitNonCondBrCriticalEdges ();
220
+
221
+ // As a temporary measure, we also eliminate move only for non-trivial types
222
+ // until we can audit the later part of the pipeline. Eventually, this should
223
+ // occur before IRGen.
224
+ P.addMoveOnlyTypeEliminator ();
231
225
}
232
226
233
227
SILPassPipelinePlan
0 commit comments