Skip to content

Commit c06e105

Browse files
committed
[Serialization] Switch to a better hash seed for lookup tables
...fulfilling the promised audit from 0747d9a. No intended functionality change /other/ than the order of already-unsorted lists. This affected a number of SIL tests that relied on deserialization order matching the original source order; I have no idea why the old hash logic would make that the case. If we think that's a valuable property, we should serialize a list of functions in addition to the iterable table. (Maybe just in SIB mode?)
1 parent b0ad06a commit c06e105

17 files changed

+152
-154
lines changed

include/swift/Serialization/ModuleFormat.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,13 @@ const uint16_t SWIFTMODULE_VERSION_MAJOR = 0;
5252
/// describe what change you made. The content of this comment isn't important;
5353
/// it just ensures a conflict if two people change the module format.
5454
/// Don't worry about adhering to the 80-column limit for this line.
55-
const uint16_t SWIFTMODULE_VERSION_MINOR = 516; // encode GenericSignature and GenericEnvironment together
55+
const uint16_t SWIFTMODULE_VERSION_MINOR = 517; // better string hash seed
56+
57+
/// A standard hash seed used for all string hashes in a serialized module.
58+
///
59+
/// This is the same as the default used by llvm::djbHash, just provided
60+
/// explicitly here to note that it's part of the format.
61+
const uint32_t SWIFTMODULE_HASH_SEED = 5381;
5662

5763
using DeclIDField = BCFixed<31>;
5864

lib/Serialization/DeserializeSIL.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,7 @@ class SILDeserializer::FuncTableInfo {
103103
external_key_type GetExternalKey(internal_key_type ID) { return ID; }
104104

105105
hash_value_type ComputeHash(internal_key_type key) {
106-
// FIXME: DJB seed=0, audit whether the default seed could be used.
107-
return llvm::djbHash(key, 0);
106+
return llvm::djbHash(key, SWIFTMODULE_HASH_SEED);
108107
}
109108

110109
static bool EqualKey(internal_key_type lhs, internal_key_type rhs) {

lib/Serialization/ModuleFile.cpp

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -391,8 +391,7 @@ class ModuleFile::DeclTableInfo {
391391

392392
hash_value_type ComputeHash(internal_key_type key) {
393393
if (key.first == DeclBaseName::Kind::Normal) {
394-
// FIXME: DJB seed=0, audit whether the default seed could be used.
395-
return llvm::djbHash(key.second, 0);
394+
return llvm::djbHash(key.second, SWIFTMODULE_HASH_SEED);
396395
} else {
397396
return (hash_value_type)key.first;
398397
}
@@ -454,8 +453,7 @@ class ModuleFile::ExtensionTableInfo {
454453
}
455454

456455
hash_value_type ComputeHash(internal_key_type key) {
457-
// FIXME: DJB seed=0, audit whether the default seed could be used.
458-
return llvm::djbHash(key, 0);
456+
return llvm::djbHash(key, SWIFTMODULE_HASH_SEED);
459457
}
460458

461459
static bool EqualKey(internal_key_type lhs, internal_key_type rhs) {
@@ -515,8 +513,7 @@ class ModuleFile::LocalDeclTableInfo {
515513
}
516514

517515
hash_value_type ComputeHash(internal_key_type key) {
518-
// FIXME: DJB seed=0, audit whether the default seed could be used.
519-
return llvm::djbHash(key, 0);
516+
return llvm::djbHash(key, SWIFTMODULE_HASH_SEED);
520517
}
521518

522519
static bool EqualKey(internal_key_type lhs, internal_key_type rhs) {
@@ -551,8 +548,7 @@ class ModuleFile::NestedTypeDeclsTableInfo {
551548
}
552549

553550
hash_value_type ComputeHash(internal_key_type key) {
554-
// FIXME: DJB seed=0, audit whether the default seed could be used.
555-
return llvm::djbHash(key, 0);
551+
return llvm::djbHash(key, SWIFTMODULE_HASH_SEED);
556552
}
557553

558554
static bool EqualKey(internal_key_type lhs, internal_key_type rhs) {
@@ -607,8 +603,7 @@ class ModuleFile::DeclMemberNamesTableInfo {
607603

608604
hash_value_type ComputeHash(internal_key_type key) {
609605
if (key.first == DeclBaseName::Kind::Normal) {
610-
// FIXME: DJB seed=0, audit whether the default seed could be used.
611-
return llvm::djbHash(key.second, 0);
606+
return llvm::djbHash(key.second, SWIFTMODULE_HASH_SEED);
612607
} else {
613608
return (hash_value_type)key.first;
614609
}
@@ -782,8 +777,7 @@ class ModuleFile::ObjCMethodTableInfo {
782777
}
783778

784779
hash_value_type ComputeHash(internal_key_type key) {
785-
// FIXME: DJB seed=0, audit whether the default seed could be used.
786-
return llvm::djbHash(key, 0);
780+
return llvm::djbHash(key, SWIFTMODULE_HASH_SEED);
787781
}
788782

789783
static bool EqualKey(internal_key_type lhs, internal_key_type rhs) {

lib/Serialization/Serialization.cpp

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,8 @@ namespace {
102102
switch (key.getKind()) {
103103
case DeclBaseName::Kind::Normal:
104104
assert(!key.empty());
105-
// FIXME: DJB seed=0, audit whether the default seed could be used.
106-
return llvm::djbHash(key.getIdentifier().str(), 0);
105+
return llvm::djbHash(key.getIdentifier().str(),
106+
SWIFTMODULE_HASH_SEED);
107107
case DeclBaseName::Kind::Subscript:
108108
return static_cast<uint8_t>(DeclNameKind::Subscript);
109109
case DeclBaseName::Kind::Constructor:
@@ -179,8 +179,7 @@ namespace {
179179

180180
hash_value_type ComputeHash(key_type_ref key) {
181181
assert(!key.empty());
182-
// FIXME: DJB seed=0, audit whether the default seed could be used.
183-
return llvm::djbHash(key.str(), 0);
182+
return llvm::djbHash(key.str(), SWIFTMODULE_HASH_SEED);
184183
}
185184

186185
int32_t getNameDataForBase(const NominalTypeDecl *nominal,
@@ -244,8 +243,7 @@ namespace {
244243

245244
hash_value_type ComputeHash(key_type_ref key) {
246245
assert(!key.empty());
247-
// FIXME: DJB seed=0, audit whether the default seed could be used.
248-
return llvm::djbHash(key, 0);
246+
return llvm::djbHash(key, SWIFTMODULE_HASH_SEED);
249247
}
250248

251249
std::pair<unsigned, unsigned> EmitKeyDataLength(raw_ostream &out,
@@ -286,8 +284,7 @@ namespace {
286284

287285
hash_value_type ComputeHash(key_type_ref key) {
288286
assert(!key.empty());
289-
// FIXME: DJB seed=0, audit whether the default seed could be used.
290-
return llvm::djbHash(key.str(), 0);
287+
return llvm::djbHash(key.str(), SWIFTMODULE_HASH_SEED);
291288
}
292289

293290
std::pair<unsigned, unsigned> EmitKeyDataLength(raw_ostream &out,
@@ -332,8 +329,7 @@ namespace {
332329
switch (key.getKind()) {
333330
case DeclBaseName::Kind::Normal:
334331
assert(!key.empty());
335-
// FIXME: DJB seed=0, audit whether the default seed could be used.
336-
return llvm::djbHash(key.getIdentifier().str(), 0);
332+
return llvm::djbHash(key.getIdentifier().str(), SWIFTMODULE_HASH_SEED);
337333
case DeclBaseName::Kind::Subscript:
338334
return static_cast<uint8_t>(DeclNameKind::Subscript);
339335
case DeclBaseName::Kind::Constructor:
@@ -4402,8 +4398,7 @@ namespace {
44024398

44034399
hash_value_type ComputeHash(key_type_ref key) {
44044400
llvm::SmallString<32> scratch;
4405-
// FIXME: DJB seed=0, audit whether the default seed could be used.
4406-
return llvm::djbHash(key.getString(scratch), 0);
4401+
return llvm::djbHash(key.getString(scratch), SWIFTMODULE_HASH_SEED);
44074402
}
44084403

44094404
std::pair<unsigned, unsigned> EmitKeyDataLength(raw_ostream &out,

lib/Serialization/SerializeSIL.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,7 @@ namespace {
109109

110110
hash_value_type ComputeHash(key_type_ref key) {
111111
assert(!key.empty());
112-
// FIXME: DJB seed=0, audit whether the default seed could be used.
113-
return llvm::djbHash(key, 0);
112+
return llvm::djbHash(key, SWIFTMODULE_HASH_SEED);
114113
}
115114

116115
std::pair<unsigned, unsigned> EmitKeyDataLength(raw_ostream &out,

test/Frontend/sil-merge-partial-modules.swift

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
// RUN: %target-swift-frontend -emit-module %t/partial.a.swiftmodule %t/partial.b.swiftmodule -module-name test -enable-library-evolution -sil-merge-partial-modules -disable-diagnostic-passes -disable-sil-perf-optzns -o %t/test.swiftmodule
77

8-
// RUN: %target-sil-opt %t/test.swiftmodule -disable-sil-linking > %t/dump.sil
8+
// RUN: %target-sil-opt %t/test.swiftmodule -disable-sil-linking -emit-sorted-sil > %t/dump.sil
99
// RUN: %FileCheck %s < %t/dump.sil
1010
// RUN: %FileCheck %s --check-prefix=NEGATIVE < %t/dump.sil
1111

@@ -40,28 +40,30 @@ public class CircleManager : ShapeManager {
4040
public override func manage() {}
4141
}
4242

43-
// FIXME: Why is the definition order totally random?
43+
// CHECK-LABEL: sil [canonical] @$s4test14publicFunctionyyF : $@convention(thin) () -> ()
44+
45+
// CHECK-LABEL: sil [serialized] [canonical] @$s4test17inlinableFunctionyyF : $@convention(thin) () -> () {
46+
// CHECK: function_ref @$s4test17inlinableFunctionyyFyycfU_
47+
// CHECK: }
48+
49+
// CHECK-LABEL: sil shared [serialized] [canonical] @$s4test17inlinableFunctionyyFyycfU_ : $@convention(thin) () -> () {
50+
// CHECK: function_ref @$s4test17versionedFunctionyyF
51+
// CHECK: }
4452

4553
// CHECK-LABEL: sil [canonical] @$s4test17versionedFunctionyyF : $@convention(thin) () -> ()
4654

4755
// CHECK-LABEL: sil [canonical] @$s4test9RectangleV4areaSfvg : $@convention(method) (Rectangle) -> Float
4856

49-
// CHECK-LABEL: sil shared [transparent] [serialized] [thunk] [canonical] @$s4test9RectangleVAA5ShapeA2aDP4drawyyFTW : $@convention(witness_method: Shape) (@in_guaranteed Rectangle) -> () {
57+
// CHECK-LABEL: sil [serialized] [canonical] @$s4test9RectangleV4drawyyF : $@convention(method) (Rectangle) -> () {
5058
// CHECK: function_ref @$s4test14publicFunctionyyF
5159
// CHECK: }
5260

53-
// CHECK-LABEL: sil [canonical] @$s4test14publicFunctionyyF : $@convention(thin) () -> ()
54-
5561
// CHECK-LABEL: sil shared [transparent] [serialized] [thunk] [canonical] @$s4test9RectangleVAA5ShapeA2aDP4areaSfvgTW : $@convention(witness_method: Shape) (@in_guaranteed Rectangle) -> Float {
5662
// CHECK: function_ref @$s4test9RectangleV4areaSfvg
5763
// CHECK: }
5864

59-
// CHECK-LABEL: sil shared [serialized] [canonical] @$s4test17inlinableFunctionyyFyycfU_ : $@convention(thin) () -> () {
60-
// CHECK: function_ref @$s4test17versionedFunctionyyF
61-
// CHECK: }
62-
63-
// CHECK-LABEL: sil [serialized] [canonical] @$s4test17inlinableFunctionyyF : $@convention(thin) () -> () {
64-
// CHECK: function_ref @$s4test17inlinableFunctionyyFyycfU_
65+
// CHECK-LABEL: sil shared [transparent] [serialized] [thunk] [canonical] @$s4test9RectangleVAA5ShapeA2aDP4drawyyFTW : $@convention(witness_method: Shape) (@in_guaranteed Rectangle) -> () {
66+
// CHECK: function_ref @$s4test9RectangleV4drawyyF
6567
// CHECK: }
6668

6769
// CHECK-LABEL: sil_witness_table [serialized] Rectangle: Shape module test {

test/SIL/Serialization/Recovery/function.sil

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// RUN: %empty-directory(%t)
22
// RUN: %target-swift-frontend -parse-sil %s -emit-sib -o %t/Library.sib -module-name Library -I %S/Inputs/good-modules -parse-stdlib
3-
// RUN: %target-sil-opt %t/Library.sib -I %S/Inputs/good-modules | %FileCheck %s
4-
// RUN: %target-sil-opt %t/Library.sib -I %S/Inputs/bad-modules | %FileCheck -check-prefix=CHECK-RECOVERY %s
5-
// RUN: %target-sil-opt %t/Library.sib -I %S/Inputs/bad-modules | %FileCheck -check-prefix=CHECK-RECOVERY-NEGATIVE %s
3+
// RUN: %target-sil-opt %t/Library.sib -I %S/Inputs/good-modules -emit-sorted-sil | %FileCheck %s
4+
// RUN: %target-sil-opt %t/Library.sib -I %S/Inputs/bad-modules -emit-sorted-sil | %FileCheck -check-prefix=CHECK-RECOVERY %s
5+
// RUN: %target-sil-opt %t/Library.sib -I %S/Inputs/bad-modules -emit-sorted-sil | %FileCheck -check-prefix=CHECK-RECOVERY-NEGATIVE %s
66

77
// CHECK-LABEL: sil_stage raw
88
// CHECK-RECOVERY-LABEL: sil_stage raw

test/SIL/Serialization/assignattr.sil

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,12 @@
22
// RUN: %empty-directory(%t)
33
// RUN: %target-sil-opt %s -emit-sib -o %t/tmp.sib -module-name assignattr
44
// RUN: %target-sil-opt %t/tmp.sib -o %t/tmp.2.sib -module-name assignattr
5-
// RUN: %target-sil-opt %t/tmp.2.sib -module-name assignattr | %FileCheck %s
5+
// RUN: %target-sil-opt %t/tmp.2.sib -module-name assignattr -emit-sorted-sil | %FileCheck %s
66

77
sil_stage raw
88

99
import Builtin
1010

11-
// CHECK-LABEL: sil [serialized] [ossa] @trivial_assign : $@convention(thin) (@in Builtin.Int32, Builtin.Int32) -> () {
12-
// CHECK: bb0([[ARG1:%[0-9]+]] : $*Builtin.Int32, [[ARG2:%[0-9]+]] : $Builtin.Int32):
13-
// CHECK: assign [[ARG2]] to [init] [[ARG1]] : $*Builtin.Int32
14-
sil [serialized] [ossa] @trivial_assign : $@convention(thin) (@in Builtin.Int32, Builtin.Int32) -> () {
15-
bb0(%0 : $*Builtin.Int32, %1 : $Builtin.Int32):
16-
assign %1 to [init] %0 : $*Builtin.Int32
17-
%2 = tuple()
18-
return %2 : $()
19-
}
20-
2111
// CHECK-LABEL: sil [serialized] [ossa] @non_trivial_assign : $@convention(thin) (@in Builtin.NativeObject, @owned Builtin.NativeObject) -> () {
2212
// CHECK: bb0([[ARG1:%[0-9]+]] : $*Builtin.NativeObject, [[ARG2:%[0-9]+]] : @owned $Builtin.NativeObject):
2313
// CHECK: [[ARG2_COPY:%.*]] = copy_value [[ARG2]]
@@ -31,3 +21,13 @@ bb0(%0 : $*Builtin.NativeObject, %1 : @owned $Builtin.NativeObject):
3121
%9999 = tuple()
3222
return %9999 : $()
3323
}
24+
25+
// CHECK-LABEL: sil [serialized] [ossa] @trivial_assign : $@convention(thin) (@in Builtin.Int32, Builtin.Int32) -> () {
26+
// CHECK: bb0([[ARG1:%[0-9]+]] : $*Builtin.Int32, [[ARG2:%[0-9]+]] : $Builtin.Int32):
27+
// CHECK: assign [[ARG2]] to [init] [[ARG1]] : $*Builtin.Int32
28+
sil [serialized] [ossa] @trivial_assign : $@convention(thin) (@in Builtin.Int32, Builtin.Int32) -> () {
29+
bb0(%0 : $*Builtin.Int32, %1 : $Builtin.Int32):
30+
assign %1 to [init] %0 : $*Builtin.Int32
31+
%2 = tuple()
32+
return %2 : $()
33+
}

test/SIL/Serialization/boxes.sil

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
// RUN: %empty-directory(%t)
33
// RUN: %target-sil-opt %s -emit-sib -o %t/tmp.sib -module-name boxes
44
// RUN: %target-sil-opt %t/tmp.sib -emit-sib -o %t/tmp.2.sib -module-name boxes
5-
// RUN: %target-sil-opt %t/tmp.2.sib -module-name boxes | %FileCheck %s
5+
// RUN: %target-sil-opt %t/tmp.2.sib -module-name boxes -emit-sorted-sil | %FileCheck %s
6+
7+
// Keep this file in sorted order by using alphabetical prefixes on the SIL functions.
68

79
sil_stage canonical
810

@@ -15,8 +17,8 @@ struct Q: P {}
1517

1618
// TODO: Transform boxes by transforming their arguments, not as single-field,
1719
// so that they work as parameters in generic SIL functions.
18-
// CHECK-LABEL: sil hidden [serialized] [ossa] @box_type_parsing : $@convention(thin) (
19-
sil hidden [serialized] [ossa] @box_type_parsing : $@convention(thin) (
20+
// CHECK-LABEL: sil hidden [serialized] [ossa] @AA_box_type_parsing : $@convention(thin) (
21+
sil hidden [serialized] [ossa] @AA_box_type_parsing : $@convention(thin) (
2022
// CHECK: <τ_0_0> { var τ_0_0 } <F>,
2123
<B>{ var B }<F>,
2224
// CHECK: <τ_0_0 where τ_0_0 : P> { let τ_0_0 } <G>,
@@ -37,8 +39,8 @@ entry(%0 : @unowned $<E>{ var E }<F>, %1 : @unowned $<F: P>{ let F }<G>, %2 : @u
3739
unreachable
3840
}
3941

40-
// CHECK-LABEL: sil hidden [serialized] [ossa] @box_type_parsing_in_generic_function : $@convention(thin) <F, G where G : P> (
41-
sil hidden [serialized] [ossa] @box_type_parsing_in_generic_function : $@convention(thin) <F, G: P> (
42+
// CHECK-LABEL: sil hidden [serialized] [ossa] @BB_box_type_parsing_in_generic_function : $@convention(thin) <F, G where G : P> (
43+
sil hidden [serialized] [ossa] @BB_box_type_parsing_in_generic_function : $@convention(thin) <F, G: P> (
4244
// CHECK: <τ_0_0> { var τ_0_0 } <F>,
4345
<B>{ var B }<F>,
4446
// CHECK: <τ_0_0 where τ_0_0 : P> { let τ_0_0 } <G>,
@@ -59,8 +61,8 @@ entry(%0 : @unowned $<E>{ var E }<F>, %1 : @unowned $<F: P>{ let F }<G>, %2 : @u
5961
unreachable
6062
}
6163

62-
// CHECK-LABEL: sil hidden [serialized] [ossa] @same_generic_param_name_in_multiple_box_signatures : $@convention(thin) (
63-
sil hidden [serialized] [ossa] @same_generic_param_name_in_multiple_box_signatures : $@convention(thin) (
64+
// CHECK-LABEL: sil hidden [serialized] [ossa] @CC_same_generic_param_name_in_multiple_box_signatures : $@convention(thin) (
65+
sil hidden [serialized] [ossa] @CC_same_generic_param_name_in_multiple_box_signatures : $@convention(thin) (
6466
// CHECK: <τ_0_0> { var τ_0_0 } <Int>,
6567
<A> { var A } <Int>,
6668
// CHECK: <τ_0_0> { var τ_0_0 } <String>
@@ -71,8 +73,8 @@ entry(%0 : @unowned $<A> { var A } <Int>, %1 : @unowned $<A> { var A } <String>)
7173
unreachable
7274
}
7375

74-
// CHECK-LABEL: sil hidden [serialized] [ossa] @same_generic_param_name_in_outer_scope : $@convention(thin) <A> (
75-
sil hidden [serialized] [ossa] @same_generic_param_name_in_outer_scope : $@convention(thin) <A> (
76+
// CHECK-LABEL: sil hidden [serialized] [ossa] @DD_same_generic_param_name_in_outer_scope : $@convention(thin) <A> (
77+
sil hidden [serialized] [ossa] @DD_same_generic_param_name_in_outer_scope : $@convention(thin) <A> (
7678
// CHECK: <τ_0_0> { var τ_0_0 } <A>
7779
<A> { var A } <A>
7880
// CHECK: ) -> ()
@@ -81,26 +83,26 @@ entry(%0 : @unowned $<B> { var B } <A>):
8183
unreachable
8284
}
8385

84-
// CHECK-LABEL: sil hidden [serialized] [ossa] @box_ownership : $@convention(thin) (@owned { var Int }, @guaranteed <τ_0_0> { let τ_0_0 } <Int>) -> ()
85-
sil hidden [serialized ] [ossa] @box_ownership : $@convention(thin) (@owned { var Int }, @guaranteed <T> { let T } <Int>) -> () {
86+
// CHECK-LABEL: sil hidden [serialized] [ossa] @EE_box_ownership : $@convention(thin) (@owned { var Int }, @guaranteed <τ_0_0> { let τ_0_0 } <Int>) -> ()
87+
sil hidden [serialized ] [ossa] @EE_box_ownership : $@convention(thin) (@owned { var Int }, @guaranteed <T> { let T } <Int>) -> () {
8688
entry(%0 : @owned ${ var Int }, %1 : @guaranteed $<T> { let T } <Int>):
8789
unreachable
8890
}
8991

90-
// CHECK-LABEL: sil hidden [serialized] [ossa] @address_of_box
91-
sil hidden [serialized] [ossa] @address_of_box : $@convention(thin) (@in { var Int }, @in <T> { let T } <Int>) -> () {
92+
// CHECK-LABEL: sil hidden [serialized] [ossa] @FF_address_of_box
93+
sil hidden [serialized] [ossa] @FF_address_of_box : $@convention(thin) (@in { var Int }, @in <T> { let T } <Int>) -> () {
9294
// CHECK: %0 : $*{ var Int }, %1 : $*<τ_0_0> { let τ_0_0 } <Int>
9395
entry(%0 : $*{ var Int }, %1 : $*<T> { let T } <Int>):
9496
unreachable
9597
}
9698

9799
sil [serialized] @serialize_all : $@convention(thin) () -> () {
98100
entry:
99-
%0 = function_ref @box_type_parsing : $@convention(thin) (<B>{ var B }<F>, <C: P>{ let C }<G>, <D: P>{ var D }<Q>, { let Int }, { var Int, let String }, {}, <X, Y, Z>{ var X, let Z }<Int, String, Optional<Double>>) -> ()
100-
%1 = function_ref @box_type_parsing_in_generic_function : $@convention(thin) <F, G: P> (<B>{ var B }<F>, <C: P>{ let C }<G>, <D: P>{ var D }<Q>, { let Int }, { var Int, let String }, {}, <X, Y, Z>{ var X, let Z }<Int, String, Optional<Double>>) -> ()
101-
%2 = function_ref @same_generic_param_name_in_multiple_box_signatures : $@convention(thin) (<A> { var A } <Int>, <A> { var A } <String>) -> ()
102-
%3 = function_ref @same_generic_param_name_in_outer_scope : $@convention(thin) <A> (<A> { var A } <A>) -> ()
103-
%4 = function_ref @box_ownership : $@convention(thin) (@owned { var Int }, @guaranteed <T> { let T } <Int>) -> ()
104-
%5 = function_ref @address_of_box : $@convention(thin) (@in { var Int }, @in <T> { let T } <Int>) -> ()
101+
%0 = function_ref @AA_box_type_parsing : $@convention(thin) (<B>{ var B }<F>, <C: P>{ let C }<G>, <D: P>{ var D }<Q>, { let Int }, { var Int, let String }, {}, <X, Y, Z>{ var X, let Z }<Int, String, Optional<Double>>) -> ()
102+
%1 = function_ref @BB_box_type_parsing_in_generic_function : $@convention(thin) <F, G: P> (<B>{ var B }<F>, <C: P>{ let C }<G>, <D: P>{ var D }<Q>, { let Int }, { var Int, let String }, {}, <X, Y, Z>{ var X, let Z }<Int, String, Optional<Double>>) -> ()
103+
%2 = function_ref @CC_same_generic_param_name_in_multiple_box_signatures : $@convention(thin) (<A> { var A } <Int>, <A> { var A } <String>) -> ()
104+
%3 = function_ref @DD_same_generic_param_name_in_outer_scope : $@convention(thin) <A> (<A> { var A } <A>) -> ()
105+
%4 = function_ref @EE_box_ownership : $@convention(thin) (@owned { var Int }, @guaranteed <T> { let T } <Int>) -> ()
106+
%5 = function_ref @FF_address_of_box : $@convention(thin) (@in { var Int }, @in <T> { let T } <Int>) -> ()
105107
unreachable
106108
}

test/SIL/Serialization/copy_value_destroy_value.sil

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// RUN: %empty-directory(%t)
33
// RUN: %target-sil-opt %s -emit-sib -o %t/tmp.sib -module-name copydestroy_value
44
// RUN: %target-sil-opt %t/tmp.sib -o %t/tmp.2.sib -module-name copydestroy_value
5-
// RUN: %target-sil-opt %t/tmp.2.sib -module-name copydestroy_value | %FileCheck %s
5+
// RUN: %target-sil-opt %t/tmp.2.sib -module-name copydestroy_value -emit-sorted-sil | %FileCheck %s
66

77
sil_stage canonical
88

@@ -21,12 +21,12 @@ bb0(%0 : @owned $@sil_unowned Builtin.NativeObject):
2121
return %1 : $Builtin.NativeObject
2222
}
2323

24-
// CHECK-LABEL: sil [serialized] [ossa] @test : $@convention(thin) (@owned Builtin.NativeObject) -> @owned Builtin.NativeObject {
24+
// CHECK-LABEL: sil [serialized] [ossa] @test_copy_value : $@convention(thin) (@owned Builtin.NativeObject) -> @owned Builtin.NativeObject {
2525
// CHECK: bb0([[ARG1:%[0-9]+]] : @owned $Builtin.NativeObject):
2626
// CHECK: [[COPY_VALUE_RESULT:%[0-9]+]] = copy_value [[ARG1]] : $Builtin.NativeObject
2727
// CHECK: destroy_value [[ARG1]]
2828
// CHECK: return [[COPY_VALUE_RESULT]]
29-
sil [serialized] [ossa] @test : $@convention(thin) (@owned Builtin.NativeObject) -> @owned Builtin.NativeObject {
29+
sil [serialized] [ossa] @test_copy_value : $@convention(thin) (@owned Builtin.NativeObject) -> @owned Builtin.NativeObject {
3030
bb0(%0 : @owned $Builtin.NativeObject):
3131
%1 = copy_value %0 : $Builtin.NativeObject
3232
destroy_value %0 : $Builtin.NativeObject

test/SIL/Serialization/dynamically_replaceable.sil

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// RUN: %empty-directory(%t)
22
// RUN: %target-swift-frontend %s -emit-module -o %t/tmp.swiftmodule
3-
// RUN: %target-sil-opt %t/tmp.swiftmodule -disable-sil-linking | %FileCheck %s
3+
// RUN: %target-sil-opt %t/tmp.swiftmodule -disable-sil-linking -emit-sorted-sil | %FileCheck %s
44

55

66
// CHECK-DAG-LABEL: sil [serialized] [dynamically_replacable] [canonical] @test_dynamically_replaceable

0 commit comments

Comments
 (0)