You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[IRGen] Use generic value witness functions for prespecialized types.
Previously, specialized value witness functions were emitted and used in
the prespecialized value witness table corresponding to and pointed to
by the prespecialized metadata for a generic type whose metadata was
prespecialized. That incurs a codesize cost: specialized value witness
functions had to be emitted. Here, the generic value witness functions
are used instead.
The change is not entirely trivial, though. We can't simply emit all
the witnesses for the unbound generic type (indeed if that were possible
there would be no need to emit a separate VWT). There are two reasons:
(1) the non-function fields (size, stride, flags, extra inhabitant
count) need to be those for the specialized generic type, (2) in the
case of multi-payload enums, the getEnumTagSinglePayload and
storeEnumTagSinglePayload witnesses cannot be those emitted for the
unspecialized generic type--instead they need to be
swift_getMultiPayloadEnumTagSinglePayload and
swift_storeMultiPayloadEnumTagSinglePayload respectively.
// CHECK-SAME: i8* bitcast ({{(%swift.opaque\* \(\[[0-9]+ x i8\]\*, \[[0-9]+ x i8\]\*, %swift.type\*\)\* @"\$[a-zA-Z0-9_]+" to i8\*|[^@]+@__swift_memcpy[0-9]+_[0-9]+[^\)]* to i8\*)}}),
10
-
// CHECK-SAME: i8* bitcast ({{[^@]+}}@__swift_noop_void_return{{[^\)]*}} to i8*),
11
-
// CHECK-SAME: i8* bitcast ({{[^@]+}}@__swift_memcpy{{[0-9]+}}_{{[0-9]+}}{{[^)]*}} to i8*),
12
-
// CHECK-SAME: i8* bitcast ({{[^@]+}}@__swift_memcpy{{[0-9]+}}_{{[0-9]+}}{{[^)]*}} to i8*),
13
-
// CHECK-SAME: i8* bitcast ({{[^@]+}}@__swift_memcpy{{[0-9]+}}_{{[0-9]+}}{{[^)]*}} to i8*),
14
-
// CHECK-SAME: i8* bitcast ({{[^@]+}}@__swift_memcpy{{[0-9]+}}_{{[0-9]+}}{{[^)]*}} to i8*),
15
-
// CHECK-SAME: i8* bitcast ({{[^@]+}}@"$s4main5ValueOySiGwet{{[^)]+}} to i8*),
16
-
// CHECK-SAME: i8* bitcast ({{[^@]+}}@"$s4main5ValueOySiGwst{{[^)]+}} to i8*),
9
+
// CHECK-SAME: i8* bitcast ({{[^@]+}}@"$s4main5ValueOwCP{{[^\)]*}} to i8*),
10
+
// CHECK-SAME: i8* bitcast ({{[^@]+}}@"$s4main5ValueOwxx{{[^)]*}} to i8*),
11
+
// CHECK-SAME: i8* bitcast ({{[^@]+}}@"$s4main5ValueOwcp{{[^)]*}} to i8*),
12
+
// CHECK-SAME: i8* bitcast ({{[^@]+}}@"$s4main5ValueOwca{{[^)]*}} to i8*),
13
+
// CHECK-SAME: i8* bitcast ({{[^@]+}}@"$s4main5ValueOwtk{{[^)]*}} to i8*),
14
+
// CHECK-SAME: i8* bitcast ({{[^@]+}}@"$s4main5ValueOwta{{[^)]*}} to i8*),
15
+
// CHECK-SAME: i8* bitcast ({{[^@]+}}@"$s4main5ValueOwet{{[^)]+}} to i8*),
16
+
// CHECK-SAME: i8* bitcast ({{[^@]+}}@"$s4main5ValueOwst{{[^)]+}} to i8*),
17
17
// CHECK-SAME: [[INT]] [[ALIGNMENT]],
18
18
// CHECK-SAME: [[INT]] [[ALIGNMENT]],
19
19
// CHECK-SAME: i32 {{[0-9]+}},
20
20
// CHECK-SAME: i32 0,
21
-
// CHECK-SAME: i8* bitcast ({{[^@]+}}@"$s4main5ValueOySiGwug{{[^)]+}} to i8*),
22
-
// CHECK-SAME: i8* bitcast ({{[^@]+}}@"$s4main5ValueOySiGwup{{[^)]+}} to i8*),
23
-
// CHECK-SAME: i8* bitcast ({{[^@]+}}@"$s4main5ValueOySiGwui{{[^)]+}} to i8*)
21
+
// CHECK-SAME: i8* bitcast ({{[^@]+}}@"$s4main5ValueOwug{{[^)]+}} to i8*),
22
+
// CHECK-SAME: i8* bitcast ({{[^@]+}}@"$s4main5ValueOwup{{[^)]+}} to i8*),
23
+
// CHECK-SAME: i8* bitcast ({{[^@]+}}@"$s4main5ValueOwui{{[^)]+}} to i8*)
// CHECK-SAME: i8* bitcast ({{(%swift.opaque\* \(\[[0-9]+ x i8\]\*, \[[0-9]+ x i8\]\*, %swift.type\*\)\* @"\$[a-zA-Z0-9_]+" to i8\*|[^@]+@__swift_memcpy[0-9]+_[0-9]+[^\)]* to i8\*)}}),
10
-
// CHECK-SAME: i8* bitcast ({{[^@]+}}@__swift_noop_void_return{{[^)]*}} to i8*),
11
-
// CHECK-SAME: i8* bitcast ({{[^@]+}}@__swift_memcpy{{[0-9]+}}_{{[0-9]+}}{{[^)]*}} to i8*),
12
-
// CHECK-SAME: i8* bitcast ({{[^@]+}}@__swift_memcpy{{[0-9]+}}_{{[0-9]+}}{{[^)]*}} to i8*),
13
-
// CHECK-SAME: i8* bitcast ({{[^@]+}}@__swift_memcpy{{[0-9]+}}_{{[0-9]+}}{{[^)]*}} to i8*),
14
-
// CHECK-SAME: i8* bitcast ({{[^@]+}}@__swift_memcpy{{[0-9]+}}_{{[0-9]+}}{{[^)]*}} to i8*),
15
-
// CHECK-SAME: i8* bitcast ({{[^@]+}}@"$s4main5ValueOyS2iGwet{{[^)]+}} to i8*),
16
-
// CHECK-SAME: i8* bitcast ({{[^@]+}}@"$s4main5ValueOyS2iGwst{{[^)]+}} to i8*),
17
-
// CHECK-SAME: [[INT]] {{[0-9]+}},
18
-
// CHECK-SAME: [[INT]] {{[0-9]+}},
19
-
// CHECK-SAME: i32 {{[0-9]+}},
20
-
// CHECK-SAME: i32 {{[0-9]+}},
21
-
// CHECK-SAME: i8* bitcast ({{[^@]+}}@"$s4main5ValueOyS2iGwug{{[^)]+}} to i8*),
22
-
// CHECK-SAME: i8* bitcast ({{[^@]+}}@"$s4main5ValueOyS2iGwup{{[^)]+}} to i8*),
23
-
// CHECK-SAME i8* bitcast ({{[^@]+}}@"$s4main5ValueOyS2iGwui{{[^)]+}} to i8*)
0 commit comments