mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Textual SIL was sometimes ambiguous when SILDeclRefs were used, because the textual representation of SILDeclRefs was the same for functions that have the same name, but different signatures.
50 lines
2.1 KiB
Plaintext
50 lines
2.1 KiB
Plaintext
// RUN: %target-sil-opt -assume-parsing-unqualified-ownership-sil -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 @_TFC4main3ABCcfMS0_FT1ySi_S0_ : $@convention(method) (Int64, @owned ABC) -> @owned ABC {
|
|
bb0(%0 : $Int64, %1 : $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: return
|
|
sil @_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!1 : (ABC) -> () -> (), $@convention(method) (@guaranteed ABC) -> () // user: %7
|
|
%7 = apply %6(%4) : $@convention(method) (@guaranteed ABC) -> ()
|
|
%9 = class_method %4 : $ABC, #ABC.member2!1 : (ABC) -> () -> (), $@convention(method) (@guaranteed ABC) -> () // user: %10
|
|
%10 = apply %9(%4) : $@convention(method) (@guaranteed ABC) -> ()
|
|
strong_release %4 : $ABC // id: %11
|
|
%12 = tuple () // user: %13
|
|
return %12 : $() // id: %13
|
|
}
|
|
|
|
sil_vtable ABC {
|
|
#ABC.member!1: _TFC4main3ABC6memberfS0_FT_T_ // main.ABC.member (main.ABC)() -> ()
|
|
#ABC.member2!1: _TFC4main3ABC7member2fS0_FT_T_ // main.ABC.member2 (main.ABC)() -> ()
|
|
}
|