Skip to content

Commit 52dbe7c

Browse files
committed
Add a round of ossa arc opts before lowering to non-ossa
1 parent d703abc commit 52dbe7c

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

lib/SILOptimizer/PassManager/PassPipeline.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,12 @@ void addFunctionPasses(SILPassPipelinePlan &P,
422422
P.addPerformanceConstantPropagation();
423423

424424
if (!P.getOptions().EnableOSSAModules) {
425+
// Last chance to run ossa opts, run them here before lowering to non-ossa.
426+
if (P.getOptions().CopyPropagation == CopyPropagationOption::On) {
427+
P.addComputeSideEffects();
428+
P.addCopyPropagation();
429+
}
430+
P.addSemanticARCOpts();
425431
if (P.getOptions().StopOptimizationBeforeLoweringOwnership)
426432
return;
427433

test/SILOptimizer/consuming_parameter.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,11 @@ public func async_dead_arg_call(o: consuming AnyObject) async {
1818

1919
// CHECK-LABEL: sil [ossa] @async_dead_arg_call_lexical : {{.*}} {
2020
// CHECK: {{bb[0-9]+}}([[INSTANCE:%[^,]+]] : @noImplicitCopy @_lexical @owned
21-
// CHECK: [[MOVE:%[^,]+]] = move_value [lexical] [[INSTANCE]]
2221
// CHECK: [[EXECUTOR:%[^,]+]] = enum $Optional<Builtin.Executor>, #Optional.none!enumelt
2322
// CHECK: [[CALLEE:%[^,]+]] = function_ref @async_callee
2423
// CHECK: apply [[CALLEE]]()
2524
// CHECK: hop_to_executor [[EXECUTOR]]
26-
// CHECK: destroy_value [[MOVE]]
25+
// CHECK: destroy_value [[INSTANCE]]
2726
// CHECK-LABEL: } // end sil function 'async_dead_arg_call_lexical'
2827
@_silgen_name("async_dead_arg_call_lexical")
2928
public func async_dead_arg_call_lexical(@_noEagerMove o: consuming AnyObject) async {

test/stdlib/move_function.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ tests.test("simpleVarTest") {
9191
expectTrue(_isUnique_native(&x))
9292

9393
var y = x
94-
expectFalse(_isUnique_native(&x))
9594
let _ = consume y
9695
expectTrue(_isUnique_native(&x))
9796
y = Klass()
@@ -101,7 +100,6 @@ tests.test("simpleVarTest") {
101100
tests.test("simpleInoutVarTest") {
102101
func inOutTest(_ x: inout Klass) {
103102
var y = x
104-
expectFalse(_isUnique_native(&x))
105103
let _ = consume y
106104
expectTrue(_isUnique_native(&x))
107105
y = Klass()

0 commit comments

Comments
 (0)