Skip to content

Commit 50163aa

Browse files
committed
Make the option sil-stop-optzns-before-lowering-ownership work at -Onone.
Just wanted to look at -Onone codegen before ownership was lowered and realized that this optimization did not work at -Onone.
1 parent 99dcabd commit 50163aa

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

Diff for: lib/SILOptimizer/PassManager/PassPipeline.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -986,6 +986,10 @@ SILPassPipelinePlan::getOnonePassPipeline(const SILOptions &Options) {
986986
// Now that we have serialized, propagate debug info.
987987
P.addMovedAsyncVarDebugInfoPropagator();
988988

989+
// If we are asked to stop optimizing before lowering ownership, do so now.
990+
if (P.Options.StopOptimizationBeforeLoweringOwnership)
991+
return P;
992+
989993
// Now strip any transparent functions that still have ownership.
990994
P.addOwnershipModelEliminator();
991995

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// RUN: %target-swift-frontend %s -emit-sil -sil-stop-optzns-before-lowering-ownership | %FileCheck %s
2+
// RUN: %target-swift-frontend %s -emit-sil | %FileCheck -check-prefix=NEGATIVE %s
3+
4+
// CHECK: sil hidden [ossa] @$s46stop_optzns_before_lowering_ownership_at_onone4testyyF : $@convention(thin) () -> () {
5+
// NEGATIVE: sil hidden @$s46stop_optzns_before_lowering_ownership_at_onone4testyyF : $@convention(thin) () -> () {
6+
func test() {
7+
8+
}

0 commit comments

Comments
 (0)