Skip to content

Commit ef972eb

Browse files
authored
[ownership] Move OME after CopyForwarding (swiftlang#33106)
* Move OME after CopyForwarding * Minor fix in CopyForwarding test
1 parent be2f85c commit ef972eb

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

lib/SILOptimizer/PassManager/PassPipeline.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,10 @@ void addFunctionPasses(SILPassPipelinePlan &P,
283283
// splits up copy_addr.
284284
P.addCopyForwarding();
285285

286+
// We earlier eliminated ownership if we are not compiling the stdlib. Now
287+
// handle the stdlib functions.
288+
P.addNonTransparentFunctionOwnershipModelEliminator();
289+
286290
// Optimize copies from a temporary (an "l-value") to a destination.
287291
P.addTempLValueOpt();
288292

@@ -489,10 +493,7 @@ static void addHighLevelFunctionPipeline(SILPassPipelinePlan &P) {
489493
// FIXME: update EagerSpecializer to be a function pass!
490494
P.addEagerSpecializer();
491495

492-
// We earlier eliminated ownership if we are not compiling the stdlib. Now
493-
// handle the stdlib functions.
494-
P.addNonTransparentFunctionOwnershipModelEliminator();
495-
496+
// stdlib ownership model elimination is done within addFunctionPasses
496497
addFunctionPasses(P, OptimizationLevelKind::HighLevel);
497498

498499
addHighLevelLoopOptPasses(P);

test/SILOptimizer/copyforward_ossa.sil

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ sil [ossa] @_TFSq4someU__fMGSqQ__FQ_GSqQ__ : $@convention(thin) <τ_0_0> (@in τ
265265

266266
sil [ossa] @_TFsoi2neU__FTGSqQ__Vs26_OptionalNilComparisonType_Sb : $@convention(thin) <τ_0_0> (@in Optional<τ_0_0>, _OptionalNilComparisonType) -> Bool
267267

268-
// CHECK-LABEL: sil hidden [ossa] @option_init
268+
// CHECK-LABEL: sil hidden [ossa] @option_init :
269269
// CHECK: alloc_stack
270270
// CHECK: alloc_stack
271271
// CHECK: alloc_stack

0 commit comments

Comments
 (0)