Files
swift-mirror/test/IRGen/generic_wt_linkage.sil
Doug Gregor 55b8698613 [Mangling] Mangle generic signature of a conformance relative to the nominal type.
Conformance manglings, which are used for witness tables and related witness
thunks, mangle the generic signature of the conformance. Since conformances
also describe the conforming type, mangle the conformances's generic signature
relative to the conforming type's generic signature.

In practice, this means that we don't mangle any part of the generic signature
into a conformance mangling now, so we see a decent win: 2.3% smaller
trie and 6.4% smaller strings section in the standard library binary.
When conditional conformances land, we'll see some generic signatures
mangling again (for the additional requirements of the constrained
extension).
2017-10-12 10:15:17 -07:00

51 lines
1.1 KiB
Plaintext
Executable File

// RUN: %target-swift-frontend %s -module-name=test -emit-ir | %FileCheck %s
sil_stage canonical
import Builtin
import Swift
import SwiftShims
protocol P {
}
struct PBox<T> where T : P {
init()
}
protocol HasSimpleAssoc {
associatedtype Assoc
}
protocol DerivedFromSimpleAssoc : HasSimpleAssoc {
}
struct GenericComputed<T> : DerivedFromSimpleAssoc where T : P {
typealias Assoc = PBox<T>
init()
}
sil_witness_table shared [serialized] <T where T : P> GenericComputed<T>: DerivedFromSimpleAssoc module nix {
base_protocol HasSimpleAssoc: <T where T : P> GenericComputed<T>: HasSimpleAssoc module nix
}
sil_witness_table shared [serialized] <T where T : P> GenericComputed<T>: HasSimpleAssoc module nix {
associated_type Assoc: PBox<T>
}
sil_default_witness_table hidden P {
}
sil_default_witness_table hidden HasSimpleAssoc {
no_default
}
sil_default_witness_table hidden DerivedFromSimpleAssoc {
no_default
}
// CHECK: @_T04test15GenericComputedVyxGAA22DerivedFromSimpleAssocAAWG = internal constant
// CHECK: define internal void @_T04test15GenericComputedVyxGAA22DerivedFromSimpleAssocAAWI