@@ -128,6 +128,23 @@ 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
+ // As a temporary measure, we also eliminate move only for non-trivial types
144
+ // until we can audit the later part of the pipeline. Eventually, this should
145
+ // occur before IRGen.
146
+ P.addMoveOnlyTypeEliminator ();
147
+
131
148
P.addAddressLowering ();
132
149
133
150
P.addFlowIsolation ();
@@ -159,34 +176,10 @@ static void addMandatoryDiagnosticOptPipeline(SILPassPipelinePlan &P) {
159
176
P.addMandatoryInlining ();
160
177
P.addMandatorySILLinker ();
161
178
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
179
// Promote loads as necessary to ensure we have enough SSA formation to emit
172
180
// SSA based diagnostics.
173
181
P.addPredictableMemoryAccessOptimizations ();
174
182
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
183
// This phase performs optimizations necessary for correct interoperation of
191
184
// Swift os log APIs with C os_log ABIs.
192
185
// Pass dependencies: this pass depends on MandatoryInlining and Mandatory
0 commit comments