File tree Expand file tree Collapse file tree 3 files changed +40
-0
lines changed Expand file tree Collapse file tree 3 files changed +40
-0
lines changed Original file line number Diff line number Diff line change @@ -594,6 +594,7 @@ static void addPerfEarlyModulePassPipeline(SILPassPipelinePlan &P) {
594594 P.addTempRValueOpt ();
595595 // Cleanup after SILGen: remove unneeded borrows/copies.
596596 if (P.getOptions ().CopyPropagation == CopyPropagationOption::On) {
597+ P.addComputeSideEffects ();
597598 P.addCopyPropagation ();
598599 }
599600 P.addSemanticARCOpts ();
Original file line number Diff line number Diff line change 3535// / TODO: Cleanup the resulting SIL by deleting instructions that produce dead
3636// / values (after removing its copies).
3737// /
38+ // / PASS DEPENDENCIES:
39+ // / - ComputeSideEffects
40+ // /
41+ // / ANALYSES USED:
42+ // / - BasicCalleeAnalysis
43+ // / - DeadEndBlocksAnalysis
44+ // / - DominanceAnalysis
45+ // / - NonLocalAccessBlockAnalysis
46+ // / - PostOrderAnalysis
47+ // /
3848// / ===----------------------------------------------------------------------===
3949
4050#define DEBUG_TYPE " copy-propagation"
Original file line number Diff line number Diff line change 1+ // RUN: %target-swift-frontend -primary-file %s -O -sil-verify-all -module-name=test -emit-sil | %FileCheck %s
2+
3+ // REQUIRES: swift_in_compiler
4+
5+ class C { }
6+
7+ @_silgen_name ( " non_barrier " )
8+ @inline ( never)
9+ func non_barrier( ) { }
10+
11+ @_silgen_name ( " borrow " )
12+ @inline ( never)
13+ func borrow( _ c: C )
14+
15+ // CHECK-LABEL: sil {{.*}}@test_hoist_over_non_barrier : {{.*}} {
16+ // CHECK: [[INSTANCE:%[^,]+]] = alloc_ref
17+ // CHECK: [[BORROW:%[^,]+]] = function_ref @borrow
18+ // CHECK: apply [[BORROW]]([[INSTANCE]])
19+ // CHECK: strong_release [[INSTANCE]]
20+ // CHECK: [[NON_BARRIER:%[^,]+]] = function_ref @non_barrier
21+ // CHECK: apply [[NON_BARRIER]]()
22+ // CHECK-LABEL: } // end sil function 'test_hoist_over_non_barrier'
23+ @_silgen_name( " test_hoist_over_non_barrier" )
24+ func test_hoist_over_non_barrier( ) {
25+ let c = C ( )
26+ borrow ( c)
27+ non_barrier ( )
28+ }
29+
You can’t perform that action at this time.
0 commit comments