Skip to content

Commit 3f360a7

Browse files
committed
[Mangling] Allow standard substitutions in protocol mangling.
Protocol name mangling didn’t always go through a path that allowed the use of standard substitutions. Enable standard substitutions for protocol name manglings where they make sense. Removes ~277k from the standard library binary size. (cherry picked from commit f232af5)
1 parent 7bdece3 commit 3f360a7

26 files changed

+95
-69
lines changed

docs/ABI/Mangling.rst

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -329,8 +329,10 @@ Types
329329
any-generic-type ::= protocol 'P' // nominal protocol type
330330
any-generic-type ::= context decl-name 'a' // typealias type (used in DWARF and USRs)
331331

332-
any-generic-type ::= 'S' KNOWN-TYPE-KIND // known nominal type substitution
333-
any-generic-type ::= 'S' NATURAL KNOWN-TYPE-KIND // repeated known type substitutions of the same kind
332+
any-generic-type ::= standard-substitutions
333+
334+
standard-substitutions ::= 'S' KNOWN-TYPE-KIND // known nominal type substitution
335+
standard-substitutions ::= 'S' NATURAL KNOWN-TYPE-KIND // repeated known type substitutions of the same kind
334336

335337
KNOWN-TYPE-KIND ::= 'A' // Swift.AutoreleasingUnsafeMutablePointer
336338
KNOWN-TYPE-KIND ::= 'a' // Swift.Array
@@ -383,6 +385,7 @@ Types
383385
KNOWN-TYPE-KIND ::= 'z' // Swift.BinaryInteger
384386

385387
protocol ::= context decl-name
388+
protocol ::= standard-substitutions
386389

387390
type ::= 'Bb' // Builtin.BridgeObject
388391
type ::= 'BB' // Builtin.UnsafeValueBuffer

include/swift/AST/ASTMangler.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,8 @@ class ASTMangler : public Mangler {
208208

209209
void appendModule(const ModuleDecl *module);
210210

211-
void appendProtocolName(const ProtocolDecl *protocol);
211+
void appendProtocolName(const ProtocolDecl *protocol,
212+
bool allowStandardSubstitution = true);
212213

213214
void appendAnyGenericType(const GenericTypeDecl *decl);
214215

lib/AST/ASTMangler.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1492,7 +1492,11 @@ void ASTMangler::appendModule(const ModuleDecl *module) {
14921492
}
14931493

14941494
/// Mangle the name of a protocol as a substitution candidate.
1495-
void ASTMangler::appendProtocolName(const ProtocolDecl *protocol) {
1495+
void ASTMangler::appendProtocolName(const ProtocolDecl *protocol,
1496+
bool allowStandardSubstitution) {
1497+
if (allowStandardSubstitution && tryAppendStandardSubstitution(protocol))
1498+
return;
1499+
14961500
appendContextOf(protocol);
14971501
auto *clangDecl = protocol->getClangDecl();
14981502
if (auto *clangProto = cast_or_null<clang::ObjCProtocolDecl>(clangDecl))

lib/Demangling/Demangler.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1195,6 +1195,17 @@ NodePointer Demangler::popTypeList() {
11951195
}
11961196

11971197
NodePointer Demangler::popProtocol() {
1198+
if (NodePointer Type = popNode(Node::Kind::Type)) {
1199+
if (Type->getNumChildren() < 1)
1200+
return nullptr;
1201+
1202+
NodePointer Proto = Type->getChild(0);
1203+
if (Proto->getKind() != Node::Kind::Protocol)
1204+
return nullptr;
1205+
1206+
return Type;
1207+
}
1208+
11981209
NodePointer Name = popNode(isDeclName);
11991210
NodePointer Ctx = popContext();
12001211
NodePointer Proto = createWithChildren(Node::Kind::Protocol, Ctx, Name);

lib/Demangling/OldRemangler.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1754,6 +1754,9 @@ void Remangler::mangleProtocol(Node *node, EntityContext &ctx) {
17541754
}
17551755

17561756
void Remangler::mangleProtocolWithoutPrefix(Node *node) {
1757+
if (mangleStandardSubstitution(node))
1758+
return;
1759+
17571760
if (node->getKind() == Node::Kind::Type) {
17581761
assert(node->getNumChildren() == 1);
17591762
node = node->begin()[0];

lib/Demangling/Remangler.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,9 @@ class Remangler {
248248
}
249249

250250
void manglePureProtocol(Node *Proto) {
251+
if (mangleStandardSubstitution(Proto))
252+
return;
253+
251254
Proto = skipType(Proto);
252255
mangleChildNodes(Proto);
253256
}
@@ -354,7 +357,8 @@ void Remangler::mangleIdentifierImpl(Node *node, bool isOperator) {
354357

355358
bool Remangler::mangleStandardSubstitution(Node *node) {
356359
if (node->getKind() != Node::Kind::Structure
357-
&& node->getKind() != Node::Kind::Enum)
360+
&& node->getKind() != Node::Kind::Enum
361+
&& node->getKind() != Node::Kind::Protocol)
358362
return false;
359363

360364
Node *context = node->getFirstChild();

lib/IRGen/IRGenMangler.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ std::string IRGenMangler::mangleTypeForLLVMTypeName(CanType Ty) {
120120
// don't start with a digit and don't need to be quoted.
121121
Buffer << 'T';
122122
if (auto P = dyn_cast<ProtocolType>(Ty)) {
123-
appendProtocolName(P->getDecl());
123+
appendProtocolName(P->getDecl(), /*allowStandardSubstitution=*/false);
124124
appendOperator("P");
125125
} else {
126126
appendType(Ty);

lib/IRGen/IRGenMangler.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ class IRGenMangler : public Mangle::ASTMangler {
109109

110110
std::string mangleBareProtocol(const ProtocolDecl *Decl) {
111111
beginMangling();
112-
appendProtocolName(Decl);
112+
appendProtocolName(Decl, /*allowStandardSubstitution=*/false);
113113
appendOperator("P");
114114
return finalize();
115115
}
@@ -344,7 +344,7 @@ class IRGenMangler : public Mangle::ASTMangler {
344344

345345
std::string mangleForProtocolDescriptor(ProtocolType *Proto) {
346346
beginMangling();
347-
appendProtocolName(Proto->getDecl());
347+
appendProtocolName(Proto->getDecl(), /*allowStandardSubstitution=*/false);
348348
appendOperator("P");
349349
return finalize();
350350
}

stdlib/public/SDK/Foundation/NSError.mm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
MANGLE_SYM(So10CFErrorRefas5Error10FoundationWa)();
2222

2323
extern "C" const SWIFT_CC(swift) hashable_support::HashableWitnessTable *
24-
MANGLE_SYM(So8NSObjectCs8Hashable10ObjectiveCWa)();
24+
MANGLE_SYM(So8NSObjectCSH10ObjectiveCWa)();
2525

2626
extern "C" SWIFT_CC(swift)
2727
NSDictionary *MANGLE_SYM(10Foundation24_getErrorDefaultUserInfoyyXlSgxs0C0RzlF)(
@@ -37,7 +37,7 @@
3737
// Define the bridging info struct.
3838
extern "C" ErrorBridgingInfo ERROR_BRIDGING_SYMBOL_NAME = {
3939
MANGLE_SYM(So10CFErrorRefas5Error10FoundationWa),
40-
MANGLE_SYM(So8NSObjectCs8Hashable10ObjectiveCWa),
40+
MANGLE_SYM(So8NSObjectCSH10ObjectiveCWa),
4141
MANGLE_SYM(10Foundation24_getErrorDefaultUserInfoyyXlSgxs0C0RzlF),
4242
MANGLE_SYM(10Foundation21_bridgeNSErrorToError_3outSbSo0C0C_SpyxGtAA021_ObjectiveCBridgeableE0RzlF),
4343
&MANGLE_SYM(10Foundation26_ObjectiveCBridgeableErrorMp)

stdlib/public/runtime/SwiftHashableSupport.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
namespace swift {
2020
namespace hashable_support {
2121

22-
extern "C" const ProtocolDescriptor PROTOCOL_DESCR_SYM(s8Hashable);
23-
static constexpr auto &HashableProtocolDescriptor = PROTOCOL_DESCR_SYM(s8Hashable);
22+
extern "C" const ProtocolDescriptor PROTOCOL_DESCR_SYM(SH);
23+
static constexpr auto &HashableProtocolDescriptor = PROTOCOL_DESCR_SYM(SH);
2424

2525
struct HashableWitnessTable;
2626

test/SILGen/array_literal_abstraction.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ func array_of_funcs() -> [(() -> ())] {
1010
return [{}, {}]
1111
}
1212

13-
// CHECK-LABEL: sil hidden @$S25array_literal_abstraction13dict_of_funcss10DictionaryVySiyycGyF
13+
// CHECK-LABEL: sil hidden @$S25array_literal_abstraction13dict_of_funcsSDySiyycGyF
1414
// CHECK: pointer_to_address {{.*}} $*(Int, @callee_guaranteed (@in_guaranteed ()) -> @out ())
1515
func dict_of_funcs() -> Dictionary<Int, () -> ()> {
1616
return [0: {}, 1: {}]

test/SILGen/collection_subtype_downcast.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@ func ==(lhs: S, rhs: S) -> Bool {
2828
}
2929

3030
// FIXME: This entrypoint name should not be bridging-specific
31-
// CHECK-LABEL: sil hidden @$S27collection_subtype_downcast05dict_C00D0s10DictionaryVyAA1SVSiGSgAEyAGypG_tF :
31+
// CHECK-LABEL: sil hidden @$S27collection_subtype_downcast05dict_C00D0SDyAA1SVSiGSgSDyAEypG_tF :
3232
// CHECK: bb0([[ARG:%.*]] : @guaranteed $Dictionary<S, Any>):
3333
// CHECK: debug_value [[ARG]]
3434
// CHECK: [[ARG_COPY:%.*]] = copy_value [[ARG]]
3535
// CHECK: // function_ref
36-
// CHECK: [[FN:%.*]] = function_ref @$Ss30_dictionaryDownCastConditionalys10DictionaryVyq0_q1_GSgACyxq_Gs8HashableRzsAGR0_r2_lF
36+
// CHECK: [[FN:%.*]] = function_ref @$Ss30_dictionaryDownCastConditionalySDyq0_q1_GSgSDyxq_GSkRzSkR0_r2_lF
3737
// CHECK: [[BORROWED_ARG_COPY:%.*]] = begin_borrow [[ARG_COPY]]
3838
// CHECK: [[RESULT:%.*]] = apply [[FN]]<S, Any, S, Int>([[BORROWED_ARG_COPY]]) : $@convention(thin) <τ_0_0, τ_0_1, τ_0_2, τ_0_3 where τ_0_0 : Hashable, τ_0_2 : Hashable> (@guaranteed Dictionary<τ_0_0, τ_0_1>) -> @owned Optional<Dictionary<τ_0_2, τ_0_3>>
3939
// CHECK: end_borrow [[BORROWED_ARG_COPY]] from [[ARG_COPY]]

test/SILGen/collection_subtype_upcast.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@ func ==(lhs: S, rhs: S) -> Bool {
2828
}
2929

3030
// FIXME: This entrypoint name should not be bridging-specific
31-
// CHECK-LABEL: sil hidden @$S25collection_subtype_upcast05dict_C00D0s10DictionaryVyAA1SVypGAEyAGSiG_tF :
31+
// CHECK-LABEL: sil hidden @$S25collection_subtype_upcast05dict_C00D0SDyAA1SVypGSDyAESiG_tF :
3232
// CHECK: bb0([[ARG:%.*]] : @guaranteed $Dictionary<S, Int>):
3333
// CHECK: debug_value [[ARG]]
3434
// CHECK: [[ARG_COPY:%.*]] = copy_value [[ARG]]
3535
// CHECK: // function_ref
36-
// CHECK: [[FN:%.*]] = function_ref @$Ss17_dictionaryUpCastys10DictionaryVyq0_q1_GACyxq_Gs8HashableRzsAFR0_r2_lF
36+
// CHECK: [[FN:%.*]] = function_ref @$Ss17_dictionaryUpCastySDyq0_q1_GSDyxq_GSkRzSkR0_r2_lF
3737
// CHECK: [[BORROWED_ARG_COPY:%.*]] = begin_borrow [[ARG_COPY]]
3838
// CHECK: [[RESULT:%.*]] = apply [[FN]]<S, Int, S, Any>([[BORROWED_ARG_COPY]]) : $@convention(thin) <τ_0_0, τ_0_1, τ_0_2, τ_0_3 where τ_0_0 : Hashable, τ_0_2 : Hashable> (@guaranteed Dictionary<τ_0_0, τ_0_1>) -> @owned Dictionary<τ_0_2, τ_0_3>
3939
// CHECK: destroy_value [[ARG_COPY]]

test/SILGen/constrained_extensions.swift

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -65,15 +65,15 @@ extension Array where Element == Int {
6565
}
6666

6767
extension Dictionary where Key == Int {
68-
// CHECK-LABEL: sil @$Ss10DictionaryV22constrained_extensionsSiRszrlE1xABySiq_Gyt_tcfC : $@convention(method) <Key, Value where Key == Int> (@thin Dictionary<Int, Value>.Type) -> @owned Dictionary<Int, Value> {
68+
// CHECK-LABEL: sil @$SSD22constrained_extensionsSiRszrlE1xABySiq_Gyt_tcfC : $@convention(method) <Key, Value where Key == Int> (@thin Dictionary<Int, Value>.Type) -> @owned Dictionary<Int, Value> {
6969
public init(x: ()) {
7070
self.init()
7171
}
7272

73-
// CHECK-LABEL: sil @$Ss10DictionaryV22constrained_extensionsSiRszrlE16instancePropertyq_vg : $@convention(method) <Key, Value where Key == Int> (@guaranteed Dictionary<Int, Value>) -> @out Value
74-
// CHECK-LABEL: sil @$Ss10DictionaryV22constrained_extensionsSiRszrlE16instancePropertyq_vs : $@convention(method) <Key, Value where Key == Int> (@in Value, @inout Dictionary<Int, Value>) -> ()
75-
// CHECK-LABEL: sil shared [transparent] [serialized] @$Ss10DictionaryV22constrained_extensionsSiRszrlE16instancePropertyq_vmytfU_ : $@convention(method) <Key, Value where Key == Int> (Builtin.RawPointer, @inout Builtin.UnsafeValueBuffer, @inout Dictionary<Int, Value>, @thick Dictionary<Int, Value>.Type) -> ()
76-
// CHECK-LABEL: sil [transparent] [serialized] @$Ss10DictionaryV22constrained_extensionsSiRszrlE16instancePropertyq_vm : $@convention(method) <Key, Value where Key == Int> (Builtin.RawPointer, @inout Builtin.UnsafeValueBuffer, @inout Dictionary<Int, Value>) -> (Builtin.RawPointer, Optional<Builtin.RawPointer>)
73+
// CHECK-LABEL: sil @$SSD22constrained_extensionsSiRszrlE16instancePropertyq_vg : $@convention(method) <Key, Value where Key == Int> (@guaranteed Dictionary<Int, Value>) -> @out Value
74+
// CHECK-LABEL: sil @$SSD22constrained_extensionsSiRszrlE16instancePropertyq_vs : $@convention(method) <Key, Value where Key == Int> (@in Value, @inout Dictionary<Int, Value>) -> ()
75+
// CHECK-LABEL: sil shared [transparent] [serialized] @$SSD22constrained_extensionsSiRszrlE16instancePropertyq_vmytfU_ : $@convention(method) <Key, Value where Key == Int> (Builtin.RawPointer, @inout Builtin.UnsafeValueBuffer, @inout Dictionary<Int, Value>, @thick Dictionary<Int, Value>.Type) -> ()
76+
// CHECK-LABEL: sil [transparent] [serialized] @$SSD22constrained_extensionsSiRszrlE16instancePropertyq_vm : $@convention(method) <Key, Value where Key == Int> (Builtin.RawPointer, @inout Builtin.UnsafeValueBuffer, @inout Dictionary<Int, Value>) -> (Builtin.RawPointer, Optional<Builtin.RawPointer>)
7777
public var instanceProperty: Value {
7878
get {
7979
return self[0]!
@@ -83,49 +83,49 @@ extension Dictionary where Key == Int {
8383
}
8484
}
8585

86-
// CHECK-LABEL: sil @$Ss10DictionaryV22constrained_extensionsSiRszrlE14instanceMethodq_yF : $@convention(method) <Key, Value where Key == Int> (@guaranteed Dictionary<Int, Value>) -> @out Value
86+
// CHECK-LABEL: sil @$SSD22constrained_extensionsSiRszrlE14instanceMethodq_yF : $@convention(method) <Key, Value where Key == Int> (@guaranteed Dictionary<Int, Value>) -> @out Value
8787
public func instanceMethod() -> Value {
8888
return instanceProperty
8989
}
9090

91-
// CHECK-LABEL: sil @$Ss10DictionaryV22constrained_extensionsSiRszrlE14instanceMethod1vq_q__tF : $@convention(method) <Key, Value where Key == Int> (@in_guaranteed Value, @guaranteed Dictionary<Int, Value>) -> @out Value
91+
// CHECK-LABEL: sil @$SSD22constrained_extensionsSiRszrlE14instanceMethod1vq_q__tF : $@convention(method) <Key, Value where Key == Int> (@in_guaranteed Value, @guaranteed Dictionary<Int, Value>) -> @out Value
9292
public func instanceMethod(v: Value) -> Value {
9393
return v
9494
}
9595

96-
// CHECK-LABEL: sil @$Ss10DictionaryV22constrained_extensionsSiRszrlE12staticMethodSiyFZ : $@convention(method) <Key, Value where Key == Int> (@thin Dictionary<Int, Value>.Type) -> Int
96+
// CHECK-LABEL: sil @$SSD22constrained_extensionsSiRszrlE12staticMethodSiyFZ : $@convention(method) <Key, Value where Key == Int> (@thin Dictionary<Int, Value>.Type) -> Int
9797
public static func staticMethod() -> Key {
9898
return staticProperty
9999
}
100100

101-
// CHECK-LABEL: sil @$Ss10DictionaryV22constrained_extensionsSiRszrlE14staticPropertySivgZ : $@convention(method) <Key, Value where Key == Int> (@thin Dictionary<Int, Value>.Type) -> Int
101+
// CHECK-LABEL: sil @$SSD22constrained_extensionsSiRszrlE14staticPropertySivgZ : $@convention(method) <Key, Value where Key == Int> (@thin Dictionary<Int, Value>.Type) -> Int
102102
public static var staticProperty: Key {
103103
return 0
104104
}
105105

106-
// CHECK-LABEL: sil @$Ss10DictionaryV22constrained_extensionsSiRszrlE12staticMethod1k1vq_SiSg_q_SgtFZfA_ : $@convention(thin) <Key, Value where Key == Int> () -> Optional<Int>
107-
// CHECK-LABEL: sil @$Ss10DictionaryV22constrained_extensionsSiRszrlE12staticMethod1k1vq_SiSg_q_SgtFZfA0_ : $@convention(thin) <Key, Value where Key == Int> () -> @out Optional<Value>
108-
// CHECK-LABEL: sil @$Ss10DictionaryV22constrained_extensionsSiRszrlE12staticMethod1k1vq_SiSg_q_SgtFZ : $@convention(method) <Key, Value where Key == Int> (Optional<Int>, @in_guaranteed Optional<Value>, @thin Dictionary<Int, Value>.Type) -> @out Value
106+
// CHECK-LABEL: sil @$SSD22constrained_extensionsSiRszrlE12staticMethod1k1vq_SiSg_q_SgtFZfA_ : $@convention(thin) <Key, Value where Key == Int> () -> Optional<Int>
107+
// CHECK-LABEL: sil @$SSD22constrained_extensionsSiRszrlE12staticMethod1k1vq_SiSg_q_SgtFZfA0_ : $@convention(thin) <Key, Value where Key == Int> () -> @out Optional<Value>
108+
// CHECK-LABEL: sil @$SSD22constrained_extensionsSiRszrlE12staticMethod1k1vq_SiSg_q_SgtFZ : $@convention(method) <Key, Value where Key == Int> (Optional<Int>, @in_guaranteed Optional<Value>, @thin Dictionary<Int, Value>.Type) -> @out Value
109109
public static func staticMethod(k: Key? = nil, v: Value? = nil) -> Value {
110110
return v!
111111
}
112112

113-
// CHECK-LABEL: sil @$Ss10DictionaryV22constrained_extensionsSiRszrlE17callsStaticMethodq_yFZ : $@convention(method) <Key, Value where Key == Int> (@thin Dictionary<Int, Value>.Type) -> @out Value
113+
// CHECK-LABEL: sil @$SSD22constrained_extensionsSiRszrlE17callsStaticMethodq_yFZ : $@convention(method) <Key, Value where Key == Int> (@thin Dictionary<Int, Value>.Type) -> @out Value
114114
public static func callsStaticMethod() -> Value {
115115
return staticMethod()
116116
}
117117

118-
// CHECK-LABEL: sil @$Ss10DictionaryV22constrained_extensionsSiRszrlE16callsConstructorq_yFZ : $@convention(method) <Key, Value where Key == Int> (@thin Dictionary<Int, Value>.Type) -> @out Value
118+
// CHECK-LABEL: sil @$SSD22constrained_extensionsSiRszrlE16callsConstructorq_yFZ : $@convention(method) <Key, Value where Key == Int> (@thin Dictionary<Int, Value>.Type) -> @out Value
119119
public static func callsConstructor() -> Value {
120120
return Dictionary(x: ()).instanceMethod()
121121
}
122122

123-
// CHECK-LABEL: sil @$Ss10DictionaryV22constrained_extensionsSiRszrlEyq_yt_tcig : $@convention(method) <Key, Value where Key == Int> (@guaranteed Dictionary<Int, Value>) -> @out Value
123+
// CHECK-LABEL: sil @$SSD22constrained_extensionsSiRszrlEyq_yt_tcig : $@convention(method) <Key, Value where Key == Int> (@guaranteed Dictionary<Int, Value>) -> @out Value
124124
public subscript(i: ()) -> Value {
125125
return self[0]!
126126
}
127127

128-
// CHECK-LABEL: sil @$Ss10DictionaryV22constrained_extensionsSiRszrlE21inoutAccessOfPropertyyyF : $@convention(method) <Key, Value where Key == Int> (@inout Dictionary<Int, Value>) -> ()
128+
// CHECK-LABEL: sil @$SSD22constrained_extensionsSiRszrlE21inoutAccessOfPropertyyyF : $@convention(method) <Key, Value where Key == Int> (@inout Dictionary<Int, Value>) -> ()
129129
public mutating func inoutAccessOfProperty() {
130130
func increment(x: inout Value) { }
131131

test/SILGen/default_arguments_imported.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ func testGizmo(gizmo: Gizmo) {
1616
// CHECK-LABEL: sil hidden @$S26default_arguments_imported21testNonnullDictionary5gizmoySo5GizmoC_tF
1717
func testNonnullDictionary(gizmo: Gizmo) {
1818
// CHECK-NOT: nilLiteral
19-
// CHECK: function_ref @$Ss10DictionaryV17dictionaryLiteralAByxq_Gx_q_td_tcfC
19+
// CHECK: function_ref @$SSD17dictionaryLiteralAByxq_Gx_q_td_tcfC
2020
// CHECK: objc_method [[SELF:%[0-9]+]] : $Gizmo, #Gizmo.doTheThing!1.foreign
2121
gizmo.doTheThing()
2222
} // CHECK: } // end sil function '$S26default_arguments_imported21testNonnullDictionary5gizmoySo5GizmoC_tF'

test/SILGen/function_conversion.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,7 @@ func rdar35702810() {
602602
// CHECK: apply %5<A, Z>(%6) : $@convention(thin) <τ_0_0, τ_0_1> (@guaranteed Array<τ_0_0>) -> @owned Array<τ_0_1>
603603
foo_arr(type: A.self, fn_arr)
604604

605-
// CHECK: function_ref @$Ss17_dictionaryUpCastys10DictionaryVyq0_q1_GACyxq_Gs8HashableRzsAFR0_r2_lF : $@convention(thin) <τ_0_0, τ_0_1, τ_0_2, τ_0_3 where τ_0_0 : Hashable, τ_0_2 : Hashable> (@guaranteed Dictionary<τ_0_0, τ_0_1>) -> @owned Dictionary<τ_0_2, τ_0_3>
605+
// CHECK: function_ref @$Ss17_dictionaryUpCastySDyq0_q1_GACyxq_GSkRzsAFR0_r2_lF : $@convention(thin) <τ_0_0, τ_0_1, τ_0_2, τ_0_3 where τ_0_0 : Hashable, τ_0_2 : Hashable> (@guaranteed Dictionary<τ_0_0, τ_0_1>) -> @owned Dictionary<τ_0_2, τ_0_3>
606606
// CHECK: apply %2<Int, A, Int, Z>(%0) : $@convention(thin) <τ_0_0, τ_0_1, τ_0_2, τ_0_3 where τ_0_0 : Hashable, τ_0_2 : Hashable> (@guaranteed Dictionary<τ_0_0, τ_0_1>) -> @owned Dictionary<τ_0_2, τ_0_3>
607607
// CHECK: apply %1(%4) : $@callee_guaranteed (@guaranteed Dictionary<Int, Z>) -> ()
608608
foo_map(type: A.self, fn_map)
@@ -631,7 +631,7 @@ func rdar35702810_anyhashable() {
631631
// CHECK: convert_escape_to_noescape [not_guaranteed] [[PA]] : $@callee_guaranteed (@guaranteed Optional<Array<B>>) -> () to $@noescape @callee_guaranteed (@guaranteed Optional<Array<B>>) -> ()
632632
bar_arr(type: B.self, fn_arr)
633633

634-
// CHECK: [[FN:%.*]] = function_ref @$Ss10DictionaryVys11AnyHashableVSiGIegg_ABy19function_conversion1BCSiGIegg_TR : $@convention(thin) (@guaranteed Dictionary<B, Int>, @guaranteed @callee_guaranteed (@guaranteed Dictionary<AnyHashable, Int>) -> ()) -> ()
634+
// CHECK: [[FN:%.*]] = function_ref @$SSDys11AnyHashableVSiGIegg_ABy19function_conversion1BCSiGIegg_TR : $@convention(thin) (@guaranteed Dictionary<B, Int>, @guaranteed @callee_guaranteed (@guaranteed Dictionary<AnyHashable, Int>) -> ()) -> ()
635635
// CHECK: [[PA:%.*]] = partial_apply [callee_guaranteed] [[FN]](%{{[0-9]+}}) : $@convention(thin) (@guaranteed Dictionary<B, Int>, @guaranteed @callee_guaranteed (@guaranteed Dictionary<AnyHashable, Int>) -> ()) -> ()
636636
// CHECK: convert_escape_to_noescape [not_guaranteed] [[PA]] : $@callee_guaranteed (@guaranteed Dictionary<B, Int>) -> () to $@noescape @callee_guaranteed (@guaranteed Dictionary<B, Int>) -> ()
637637
bar_map(type: B.self, fn_map)

0 commit comments

Comments
 (0)