mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
* move the apply of partial_apply transformation from simplify-apply to simplify-partial_apply * delete dead partial_apply instructions * devirtualize apply, try_apply and begin_apply
37 lines
1020 B
Plaintext
37 lines
1020 B
Plaintext
// RUN: %target-sil-opt -enable-sil-verify-all %s -onone-simplification -simplify-instruction=begin_apply | %FileCheck %s
|
|
|
|
// REQUIRES: swift_in_compiler
|
|
|
|
sil_stage canonical
|
|
|
|
import Builtin
|
|
import Swift
|
|
import SwiftShims
|
|
|
|
class Bar {
|
|
init()
|
|
@_borrowed @_hasStorage var field: Int { get set }
|
|
}
|
|
|
|
// CHECK-LABEL: sil @devirt_class_method :
|
|
// CHECK: [[F:%.*]] = function_ref @bar_field_read
|
|
// CHECK: begin_apply [[F]]
|
|
// CHECK: } // end sil function 'devirt_class_method'
|
|
sil @devirt_class_method : $@convention(thin) () -> (Int, @error any Error) {
|
|
bb0:
|
|
%0 = alloc_ref $Bar
|
|
%1 = class_method %0 : $Bar, #Bar.field!read : (Bar) -> () -> (), $@yield_once @convention(method) (@guaranteed Bar) -> @yields Int
|
|
(%2, %3) = begin_apply %1(%0) : $@yield_once @convention(method) (@guaranteed Bar) -> @yields Int
|
|
end_apply %3
|
|
return %2 : $Int
|
|
}
|
|
|
|
sil @bar_field_read : $@yield_once @convention(method) (@guaranteed Bar) -> @yields Int
|
|
|
|
sil_vtable Bar {
|
|
#Bar.field!read: @bar_field_read
|
|
}
|
|
|
|
|
|
|