mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
50 lines
2.2 KiB
Plaintext
50 lines
2.2 KiB
Plaintext
// RUN: %target-sil-opt -enable-sil-verify-all %s -inline -devirtualizer | %FileCheck %s
|
|
|
|
sil_stage canonical
|
|
|
|
import Builtin
|
|
import Swift
|
|
|
|
class ABC {
|
|
init(y : Int)
|
|
func member()
|
|
func member2()
|
|
}
|
|
|
|
|
|
// This is our c'tor.
|
|
sil [ossa] @_TFC4main3ABCcfMS0_FT1ySi_S0_ : $@convention(method) (Int64, @owned ABC) -> @owned ABC {
|
|
bb0(%0 : $Int64, %1 : @owned $ABC):
|
|
return %1 : $ABC // id: %38
|
|
}
|
|
|
|
sil @_TFC4main3ABC6memberfS0_FT_T_ : $@convention(method) (@guaranteed ABC) -> ()
|
|
sil @_TFC4main3ABC7member2fS0_FT_T_ : $@convention(method) (@guaranteed ABC) -> ()
|
|
sil @_TFC4main3ABCCfMS0_FT1ySi_S0_ : $@convention(thin) (Int64, @thick ABC.Type) -> @owned ABC
|
|
|
|
// CHECK: @_TF4main3fooFT_T_ :
|
|
// CHECK: function_ref @_TFC4main3ABC6memberfS0_FT_T_
|
|
// CHECK: function_ref @_TFC4main3ABC7member2fS0_FT_T_
|
|
// CHECK: } // end sil function '_TF4main3fooFT_T_'
|
|
sil [ossa] @_TF4main3fooFT_T_ : $@convention(thin) () -> () {
|
|
bb0:
|
|
%0 = integer_literal $Builtin.Int64, 7 // user: %1
|
|
%1 = struct $Int64 (%0 : $Builtin.Int64) // user: %4
|
|
%2 = alloc_ref $ABC // user: %4
|
|
// function_ref main.ABC.init (main.ABC.Type)(y : Swift.Int64) -> main.ABC
|
|
%3 = function_ref @_TFC4main3ABCcfMS0_FT1ySi_S0_ : $@convention(method) (Int64, @owned ABC) -> @owned ABC // user: %4
|
|
%4 = apply %3(%1, %2) : $@convention(method) (Int64, @owned ABC) -> @owned ABC // users: %7, %6, %5, %10, %9, %8, %11
|
|
%6 = class_method %4 : $ABC, #ABC.member : (ABC) -> () -> (), $@convention(method) (@guaranteed ABC) -> () // user: %7
|
|
%7 = apply %6(%4) : $@convention(method) (@guaranteed ABC) -> ()
|
|
%9 = class_method %4 : $ABC, #ABC.member2 : (ABC) -> () -> (), $@convention(method) (@guaranteed ABC) -> () // user: %10
|
|
%10 = apply %9(%4) : $@convention(method) (@guaranteed ABC) -> ()
|
|
destroy_value %4 : $ABC // id: %11
|
|
%12 = tuple () // user: %13
|
|
return %12 : $() // id: %13
|
|
}
|
|
|
|
sil_vtable ABC {
|
|
#ABC.member: @_TFC4main3ABC6memberfS0_FT_T_ // main.ABC.member (main.ABC)() -> ()
|
|
#ABC.member2: @_TFC4main3ABC7member2fS0_FT_T_ // main.ABC.member2 (main.ABC)() -> ()
|
|
}
|