Files
swift-mirror/test/SILOptimizer/inlinecaches_arc.sil
Roman Levenstein 8ad61d5cd6 Use function signatures for SILDeclRefs in witness_tables, vtables and witness_method instructions.
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.
2017-01-27 12:16:14 -08:00

45 lines
1.4 KiB
Plaintext

// RUN: %target-sil-opt -assume-parsing-unqualified-ownership-sil -enable-sil-verify-all %s -specdevirt -code-sinking -emit-sorted-sil | %FileCheck %s
sil_stage canonical
import Builtin
import Swift
class Foo {
func ping() -> Int
}
sil @_TFC4main3Foo4pingfS0_FT_Si : $@convention(method) (@guaranteed Foo) -> Int
sil @_TFC4main3FoocfMS0_FT_S0_ : $@convention(method) (@owned Foo) -> @owned Foo
// CHECK-LABEL: _TF4main7my_mainFCS_3FooSi
// CHECK: bb0
// CHECK-NOT: strong_retain
// CHECK: checked_cast_br [exact] %0 : $Foo to $Foo
// CHECK: bb1
// CHECK: class_method
// CHECK-NEXT: apply
// CHECK: strong_release
// CHECK: bb2
// CHECK: function_ref
// CHECK: apply
// CHECK: strong_release
// CHECK: bb3
// CHECK-NOT: strong_release
sil @_TF4main7my_mainFCS_3FooSi : $@convention(thin) (@owned Foo) -> Int {
bb0(%0 : $Foo):
debug_value %0 : $Foo, let, name "x" // id: %1
%3 = class_method %0 : $Foo, #Foo.ping!1 : (Foo) -> () -> Int, $@convention(method) (@guaranteed Foo) -> Int // user: %4
%4 = apply %3(%0) : $@convention(method) (@guaranteed Foo) -> Int // user: %6
strong_release %0 : $Foo // id: %5
return %4 : $Int // id: %6
}
sil_vtable Foo {
#Foo.ping!1: _TFC4main3Foo4pingfS0_FT_Si // main.Foo.ping (main.Foo)() -> Swift.Int
#Foo.init!initializer.1: _TFC4main3FoocfMS0_FT_S0_ // main.Foo.init (main.Foo.Type)() -> main.Foo
}