Skip to content

[ownership] Move OME after CopyForwarding #33106

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
merged 2 commits into from
Sep 25, 2020
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
9 changes: 5 additions & 4 deletions lib/SILOptimizer/PassManager/PassPipeline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,10 @@ void addFunctionPasses(SILPassPipelinePlan &P,
// splits up copy_addr.
P.addCopyForwarding();

// We earlier eliminated ownership if we are not compiling the stdlib. Now
// handle the stdlib functions.
P.addNonTransparentFunctionOwnershipModelEliminator();

// Optimize copies from a temporary (an "l-value") to a destination.
P.addTempLValueOpt();

Expand Down Expand Up @@ -482,10 +486,7 @@ static void addHighLevelFunctionPipeline(SILPassPipelinePlan &P) {
// FIXME: update EagerSpecializer to be a function pass!
P.addEagerSpecializer();

// We earlier eliminated ownership if we are not compiling the stdlib. Now
// handle the stdlib functions.
P.addNonTransparentFunctionOwnershipModelEliminator();

// stdlib ownership model elimination is done within addFunctionPasses
addFunctionPasses(P, OptimizationLevelKind::HighLevel);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a note here that we are lowering ownership in side addFunctionPasses. I am just trying to be very careful/explicit during the transition.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


addHighLevelLoopOptPasses(P);
Expand Down
2 changes: 1 addition & 1 deletion test/SILOptimizer/copyforward_ossa.sil
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ sil [ossa] @_TFSq4someU__fMGSqQ__FQ_GSqQ__ : $@convention(thin) <τ_0_0> (@in τ

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

// CHECK-LABEL: sil hidden [ossa] @option_init
// CHECK-LABEL: sil hidden [ossa] @option_init :
// CHECK: alloc_stack
// CHECK: alloc_stack
// CHECK: alloc_stack
Expand Down