Files
swift-mirror/test/SILOptimizer/dead_func_init_method.sil
2020-03-19 02:20:21 -04:00

48 lines
1.0 KiB
Plaintext

// RUN: %target-sil-opt -sil-deadfuncelim %s | %FileCheck %s
// Check that we don't crash on this.
sil_stage canonical
import Builtin
import Swift
import SwiftShims
private class Base {
init()
}
private class Derived : Base {
}
sil private @BaseInit : $@convention(method) (@thick Base.Type) -> @owned Base {
bb0(%4 : $@thick Base.Type):
return undef : $Base
}
sil private @DerivedInit : $@convention(method) (@thick Derived.Type) -> @owned Derived {
bb0(%4 : $@thick Derived.Type):
return undef : $Derived
}
sil @testit : $@convention(method) (@thick Derived.Type) -> @thick Derived.Type {
bb0(%1 : $@thick Derived.Type):
%157 = class_method %1 : $@thick Derived.Type, #Derived.init!allocator : (Derived.Type) -> () -> Derived, $@convention(method) (@thick Derived.Type) -> @owned Derived
return %1 : $@thick Derived.Type
}
sil_vtable Base {
#Base.init!allocator: @BaseInit
}
sil_vtable Derived {
#Base.init!allocator: @DerivedInit
}
// CHECK-LABEL: sil_vtable Base
// CHECK-: BaseInit
// CHECK-LABEL: sil_vtable Derived
// CHECK: DerivedInit