blob: 25179b257d92ec14b72f17f1c963d7a80017db65 [file] [log] [blame]
// RUN: %target-sil-opt -remove-dead-conformances -assume-parsing-unqualified-ownership-sil -enable-sil-verify-all -sil-deadfuncelim %s | %FileCheck %s
sil_stage canonical
import Builtin
import Swift
import SwiftShims
public protocol Proto {
func foo()
}
private struct Struct1 : Proto {
func foo()
}
private struct Struct2 : Proto {
func foo()
}
sil hidden_external @generic_func : $@convention(thin) _0_0> (@in τ_0_0) -> ()
// CHECK: sil @let_metadata_of_Struct1_escape
sil @let_metadata_of_Struct1_escape : $@convention(c) () -> () {
bb0:
%2 = function_ref @generic_func : $@convention(thin) _0_0> (@in τ_0_0) -> ()
%3 = struct $Struct1 ()
%4 = alloc_stack $Struct1
store %3 to %4 : $*Struct1
%6 = apply %2<Struct1>(%4) : $@convention(thin) _0_0> (@in τ_0_0) -> ()
dealloc_stack %4 : $*Struct1
%r = tuple ()
return %r : $()
}
// CHECK-NOT: sil @struct2_witness
// CHECK: sil @struct1_witness
// CHECK-NOT: sil @struct2_witness
sil @struct1_witness : $@convention(witness_method) (@in_guaranteed Struct1) -> ()
sil @struct2_witness : $@convention(witness_method) (@in_guaranteed Struct2) -> ()
// CHECK-NOT: sil_witness_table Struct2
// CHECK: sil_witness_table Struct1
// CHECK-NOT: sil_witness_table Struct2
sil_witness_table Struct1: Proto module nix {
method #Proto.foo!1: @struct1_witness
}
sil_witness_table Struct2: Proto module nix {
method #Proto.foo!1: @struct2_witness
}