mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Add a run of ComputeSideEffects before the first run of CopyPropagation. Allow hoisting over applies of functions that are able to be analyzed not to be deinit barriers at this early point.
30 lines
859 B
Swift
30 lines
859 B
Swift
// RUN: %target-swift-frontend -primary-file %s -O -sil-verify-all -module-name=test -emit-sil | %FileCheck %s
|
|
|
|
// REQUIRES: swift_in_compiler
|
|
|
|
class C {}
|
|
|
|
@_silgen_name("non_barrier")
|
|
@inline(never)
|
|
func non_barrier() {}
|
|
|
|
@_silgen_name("borrow")
|
|
@inline(never)
|
|
func borrow(_ c: C)
|
|
|
|
// CHECK-LABEL: sil {{.*}}@test_hoist_over_non_barrier : {{.*}} {
|
|
// CHECK: [[INSTANCE:%[^,]+]] = alloc_ref
|
|
// CHECK: [[BORROW:%[^,]+]] = function_ref @borrow
|
|
// CHECK: apply [[BORROW]]([[INSTANCE]])
|
|
// CHECK: strong_release [[INSTANCE]]
|
|
// CHECK: [[NON_BARRIER:%[^,]+]] = function_ref @non_barrier
|
|
// CHECK: apply [[NON_BARRIER]]()
|
|
// CHECK-LABEL: } // end sil function 'test_hoist_over_non_barrier'
|
|
@_silgen_name("test_hoist_over_non_barrier")
|
|
func test_hoist_over_non_barrier() {
|
|
let c = C()
|
|
borrow(c)
|
|
non_barrier()
|
|
}
|
|
|