Skip to content

Commit 056e18c

Browse files
committed
Add and fix test case
1 parent 79784a8 commit 056e18c

File tree

3 files changed

+36
-26
lines changed

3 files changed

+36
-26
lines changed

test/IRGen/big_types_tests.sil

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ public struct BigStruct {
2121

2222
// CHECK-LABEL: define{{( dllexport)?}}{{( protected)?}} swiftcc void @testDestroyValue(ptr noalias nocapture dereferenceable({{.*}}) #0 {
2323
// CHECK-NEXT: entry
24-
// CHECK-NEXT: call ptr @"$s15big_types_tests9BigStructVWOs"(ptr %0)
2524
// CHECK-NEXT: ret void
2625
sil @testDestroyValue : $@convention(thin) (@owned BigStruct) -> () {
2726
entry(%x : $BigStruct):

test/IRGen/moveonly_value_functions.swift

Lines changed: 8 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -177,16 +177,16 @@ public func takeOuterDeinitingNC_1<T>(_ t: consuming OuterDeinitingNC_1<T>) {
177177
// CHECK-SAME: ptr{{.*}} %0,
178178
// CHECK-SAME: ptr %T)
179179
// CHECK-SAME: {
180-
// CHECK: call{{.*}} @"$s24moveonly_value_functions9OuterNC_1VyxGlWOs"(
180+
// CHECK: call{{.*}} @"$s24moveonly_value_functions9OuterNC_1VyxGlWOh"(
181181
// CHECK-SAME: ptr %0,
182182
// CHECK-SAME: ptr %T)
183183
// CHECK: }
184184

185185
// Verify that the outlined release function takes the metadata for the
186186
// move-only-with-deinit type InnerDeinitingReleasableNC<T> and passes it along
187187
// to that deinit.
188-
// $s24moveonly_value_functions9OuterNC_1VyxGlWOs ---> outlined release of moveonly_value_functions.OuterNC_2<A>
189-
// CHECK-LABEL: define{{.*}} @"$s24moveonly_value_functions9OuterNC_1VyxGlWOs"(
188+
// $s24moveonly_value_functions9OuterNC_1VyxGlWOh ---> outlined destroy of moveonly_value_functions.OuterNC_2<A>
189+
// CHECK-LABEL: define{{.*}} @"$s24moveonly_value_functions9OuterNC_1VyxGlWOh"(
190190
// CHECK-SAME: ptr %0,
191191
// CHECK-SAME: ptr %T)
192192
// CHECK-SAME: {
@@ -298,24 +298,15 @@ public func takeOuterSinglePayloadNC_1<T>(_ e: consuming OuterSinglePayloadNC_1<
298298
// : ptr noalias nocapture dereferenceable(64) %0,
299299
// CHECK-SAME: ptr %T)
300300
// CHECK-SAME: {
301-
// CHECK: call{{.*}} @"$s24moveonly_value_functions22OuterSinglePayloadNC_2OyxGlWOs"(
301+
// CHECK: call{{.*}} @"$s24moveonly_value_functions22OuterSinglePayloadNC_2OyxGlWOh"(
302302
// CHECK-SAME: ptr %0,
303303
// CHECK-SAME: ptr %T)
304304
// CHECK: }
305-
// CHECK-LABEL: define{{.*}} @"$s24moveonly_value_functions22OuterSinglePayloadNC_2OyxGlWOs"(
305+
// CHECK-LABEL: define{{.*}} @"$s24moveonly_value_functions22OuterSinglePayloadNC_2OyxGlWOh"(
306306
// CHECK-SAME: ptr %0,
307307
// CHECK-SAME: ptr %T)
308308
// CHECK-SAME: {
309-
// CHECK: call{{.*}} @"$s24moveonly_value_functions22OuterSinglePayloadNC_2OyxGlWOe"(
310-
// : i64 %2,
311-
// : i64 %4,
312-
// : i64 %6,
313-
// : i64 %8,
314-
// : i64 %10,
315-
// : i64 %12,
316-
// : i64 %14,
317-
// : i64 %16,
318-
// : ptr %T)
309+
// CHECK: call{{.*}} @"$s24moveonly_value_functions26InnerDeinitingReleasableNCVfD"(
319310
// CHECK: }
320311
public func takeOuterSinglePayloadNC_2<T>(_ e: consuming OuterSinglePayloadNC_2<T>) {}
321312

@@ -400,23 +391,15 @@ public func takeOuterMultiPayloadNC_2<T>(_ e: consuming OuterMultiPayloadNC_2<T>
400391
// : ptr noalias nocapture dereferenceable(64) %0,
401392
// CHECK-SAME: ptr %T)
402393
// CHECK-SAME: {
403-
// CHECK: call{{.*}} @"$s24moveonly_value_functions21OuterMultiPayloadNC_3OyxGlWOs"(
394+
// CHECK: call{{.*}} @"$s24moveonly_value_functions21OuterMultiPayloadNC_3OyxGlWOh"(
404395
// CHECK-SAME: ptr %0,
405396
// CHECK-SAME: ptr %T)
406397
// CHECK: }
407-
// CHECK-LABEL: define{{.*}} @"$s24moveonly_value_functions21OuterMultiPayloadNC_3OyxGlWOs"(
398+
// CHECK-LABEL: define{{.*}} @"$s24moveonly_value_functions21OuterMultiPayloadNC_3OyxGlWOh"(
408399
// CHECK-SAME: ptr %0,
409400
// CHECK-SAME: ptr %T)
410401
// CHECK-SAME: {
411402
// CHECK: call{{.*}} @"$s24moveonly_value_functions21OuterMultiPayloadNC_3OyxGlWOe"(
412-
// : i64 %2,
413-
// : i64 %4,
414-
// : i64 %6,
415-
// : i64 %8,
416-
// : i64 %10,
417-
// : i64 %12,
418-
// : i64 %14,
419-
// : i64 %16,
420403
// CHECK-SAME: ptr %T)
421404
// CHECK: }
422405
public func takeOuterMultiPayloadNC_3<T>(_ e: consuming OuterMultiPayloadNC_3<T>) {}

test/IRGen/variadic_generic_outlining.sil

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,31 @@ bb3:
4545
%ret = tuple ()
4646
return %ret : $()
4747
}
48+
49+
sil hidden @test_outlining_retain_release_addr : $@convention(thin) <each T> (@pack_guaranteed Pack{repeat Wrapper<each T>}) -> @pack_out Pack{repeat Wrapper<each T>} {
50+
bb0(%0 : $*Pack{repeat Wrapper<each T>}, %1 : $*Pack{repeat Wrapper<each T>}):
51+
%zero = integer_literal $Builtin.Word, 0
52+
%one = integer_literal $Builtin.Word, 1
53+
%len = pack_length $Pack{repeat each T}
54+
br bb1(%zero : $Builtin.Word)
55+
56+
bb1(%idx : $Builtin.Word):
57+
%done = builtin "cmp_eq_Word"(%idx : $Builtin.Word, %len : $Builtin.Word) : $Builtin.Int1 // user: %10
58+
cond_br %done, bb3, bb2
59+
60+
bb2:
61+
%pi = dynamic_pack_index %idx of $Pack{repeat Wrapper<each T>}
62+
%opening = open_pack_element %pi of <each T> at <Pack{repeat each T}>, shape $T, uuid "31FF306C-BF88-11ED-A03F-ACDE48001123"
63+
%in = pack_element_get %pi of %0 : $*Pack{repeat Wrapper<each T>} as $*Wrapper<@pack_element("31FF306C-BF88-11ED-A03F-ACDE48001123") T>
64+
%out = pack_element_get %pi of %1 : $*Pack{repeat Wrapper<each T>} as $*Wrapper<@pack_element("31FF306C-BF88-11ED-A03F-ACDE48001123") T>
65+
// Make sure that these don't crash.
66+
retain_value_addr %in : $*Wrapper<@pack_element("31FF306C-BF88-11ED-A03F-ACDE48001123") T>
67+
release_value_addr %in : $*Wrapper<@pack_element("31FF306C-BF88-11ED-A03F-ACDE48001123") T>
68+
copy_addr %in to [init] %out : $*Wrapper<@pack_element("31FF306C-BF88-11ED-A03F-ACDE48001123") T>
69+
%next = builtin "add_Word"(%idx : $Builtin.Word, %one : $Builtin.Word) : $Builtin.Word
70+
br bb1(%next : $Builtin.Word)
71+
72+
bb3:
73+
%ret = tuple ()
74+
return %ret : $()
75+
}

0 commit comments

Comments
 (0)