mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
The ComputeEffects pass derives escape information for function arguments and adds those effects in the function. This needs a lot of changes in check-lines in the tests, because the effects are printed in SIL
35 lines
921 B
Swift
35 lines
921 B
Swift
// RUN: %target-swift-frontend -parse-as-library -O -emit-sil %s | %FileCheck %s
|
|
// REQUIRES: swift_stdlib_no_asserts,optimized_stdlib
|
|
|
|
@inline(never)
|
|
func useit<T>(_ t: T) {
|
|
print(t)
|
|
}
|
|
|
|
// Check that we inline the Array.subscript.read coroutine
|
|
|
|
// CHECK-LABEL: sil {{.*@.*}}testit
|
|
// CHECK-NOT: begin_apply
|
|
// CHECK-NOT: end_apply
|
|
// CHECK: } // end sil function {{.*}}testit
|
|
public func testit<T>(_ a: [T]) {
|
|
for t in a {
|
|
useit(t)
|
|
}
|
|
}
|
|
|
|
// Check that we inline the ManagedBufferPointer.header.read coroutine
|
|
|
|
public final class MyBuffer<Element> {
|
|
typealias Manager = ManagedBufferPointer<Int, Element>
|
|
|
|
// CHECK-LABEL: sil @{{.*}}MyBuffer{{.*}}countSivg
|
|
// CHECK-NOT: begin_apply
|
|
// CHECK-NOT: end_apply
|
|
// CHECK: } // end sil function {{.*}}MyBuffer{{.*}}countSivg
|
|
public var count: Int {
|
|
return Manager(unsafeBufferObject: self).header
|
|
}
|
|
}
|
|
|