mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Add and fix test case
This commit is contained in:
@@ -21,7 +21,6 @@ public struct BigStruct {
|
||||
|
||||
// CHECK-LABEL: define{{( dllexport)?}}{{( protected)?}} swiftcc void @testDestroyValue(ptr noalias nocapture dereferenceable({{.*}}) #0 {
|
||||
// CHECK-NEXT: entry
|
||||
// CHECK-NEXT: call ptr @"$s15big_types_tests9BigStructVWOs"(ptr %0)
|
||||
// CHECK-NEXT: ret void
|
||||
sil @testDestroyValue : $@convention(thin) (@owned BigStruct) -> () {
|
||||
entry(%x : $BigStruct):
|
||||
|
||||
@@ -177,7 +177,7 @@ public func takeOuterDeinitingNC_1<T>(_ t: consuming OuterDeinitingNC_1<T>) {
|
||||
// CHECK-SAME: ptr{{.*}} %0,
|
||||
// CHECK-SAME: ptr %T)
|
||||
// CHECK-SAME: {
|
||||
// CHECK: call{{.*}} @"$s24moveonly_value_functions9OuterNC_1VyxGlWOs"(
|
||||
// CHECK: call{{.*}} @"$s24moveonly_value_functions9OuterNC_1VyxGlWOh"(
|
||||
// CHECK-SAME: ptr %0,
|
||||
// CHECK-SAME: ptr %T)
|
||||
// CHECK: }
|
||||
@@ -185,8 +185,8 @@ public func takeOuterDeinitingNC_1<T>(_ t: consuming OuterDeinitingNC_1<T>) {
|
||||
// Verify that the outlined release function takes the metadata for the
|
||||
// move-only-with-deinit type InnerDeinitingReleasableNC<T> and passes it along
|
||||
// to that deinit.
|
||||
// $s24moveonly_value_functions9OuterNC_1VyxGlWOs ---> outlined release of moveonly_value_functions.OuterNC_2<A>
|
||||
// CHECK-LABEL: define{{.*}} @"$s24moveonly_value_functions9OuterNC_1VyxGlWOs"(
|
||||
// $s24moveonly_value_functions9OuterNC_1VyxGlWOh ---> outlined destroy of moveonly_value_functions.OuterNC_2<A>
|
||||
// CHECK-LABEL: define{{.*}} @"$s24moveonly_value_functions9OuterNC_1VyxGlWOh"(
|
||||
// CHECK-SAME: ptr %0,
|
||||
// CHECK-SAME: ptr %T)
|
||||
// CHECK-SAME: {
|
||||
@@ -298,24 +298,15 @@ public func takeOuterSinglePayloadNC_1<T>(_ e: consuming OuterSinglePayloadNC_1<
|
||||
// : ptr noalias nocapture dereferenceable(64) %0,
|
||||
// CHECK-SAME: ptr %T)
|
||||
// CHECK-SAME: {
|
||||
// CHECK: call{{.*}} @"$s24moveonly_value_functions22OuterSinglePayloadNC_2OyxGlWOs"(
|
||||
// CHECK: call{{.*}} @"$s24moveonly_value_functions22OuterSinglePayloadNC_2OyxGlWOh"(
|
||||
// CHECK-SAME: ptr %0,
|
||||
// CHECK-SAME: ptr %T)
|
||||
// CHECK: }
|
||||
// CHECK-LABEL: define{{.*}} @"$s24moveonly_value_functions22OuterSinglePayloadNC_2OyxGlWOs"(
|
||||
// CHECK-LABEL: define{{.*}} @"$s24moveonly_value_functions22OuterSinglePayloadNC_2OyxGlWOh"(
|
||||
// CHECK-SAME: ptr %0,
|
||||
// CHECK-SAME: ptr %T)
|
||||
// CHECK-SAME: {
|
||||
// CHECK: call{{.*}} @"$s24moveonly_value_functions22OuterSinglePayloadNC_2OyxGlWOe"(
|
||||
// : i64 %2,
|
||||
// : i64 %4,
|
||||
// : i64 %6,
|
||||
// : i64 %8,
|
||||
// : i64 %10,
|
||||
// : i64 %12,
|
||||
// : i64 %14,
|
||||
// : i64 %16,
|
||||
// : ptr %T)
|
||||
// CHECK: call{{.*}} @"$s24moveonly_value_functions26InnerDeinitingReleasableNCVfD"(
|
||||
// CHECK: }
|
||||
public func takeOuterSinglePayloadNC_2<T>(_ e: consuming OuterSinglePayloadNC_2<T>) {}
|
||||
|
||||
@@ -400,23 +391,15 @@ public func takeOuterMultiPayloadNC_2<T>(_ e: consuming OuterMultiPayloadNC_2<T>
|
||||
// : ptr noalias nocapture dereferenceable(64) %0,
|
||||
// CHECK-SAME: ptr %T)
|
||||
// CHECK-SAME: {
|
||||
// CHECK: call{{.*}} @"$s24moveonly_value_functions21OuterMultiPayloadNC_3OyxGlWOs"(
|
||||
// CHECK: call{{.*}} @"$s24moveonly_value_functions21OuterMultiPayloadNC_3OyxGlWOh"(
|
||||
// CHECK-SAME: ptr %0,
|
||||
// CHECK-SAME: ptr %T)
|
||||
// CHECK: }
|
||||
// CHECK-LABEL: define{{.*}} @"$s24moveonly_value_functions21OuterMultiPayloadNC_3OyxGlWOs"(
|
||||
// CHECK-LABEL: define{{.*}} @"$s24moveonly_value_functions21OuterMultiPayloadNC_3OyxGlWOh"(
|
||||
// CHECK-SAME: ptr %0,
|
||||
// CHECK-SAME: ptr %T)
|
||||
// CHECK-SAME: {
|
||||
// CHECK: call{{.*}} @"$s24moveonly_value_functions21OuterMultiPayloadNC_3OyxGlWOe"(
|
||||
// : i64 %2,
|
||||
// : i64 %4,
|
||||
// : i64 %6,
|
||||
// : i64 %8,
|
||||
// : i64 %10,
|
||||
// : i64 %12,
|
||||
// : i64 %14,
|
||||
// : i64 %16,
|
||||
// CHECK-SAME: ptr %T)
|
||||
// CHECK: }
|
||||
public func takeOuterMultiPayloadNC_3<T>(_ e: consuming OuterMultiPayloadNC_3<T>) {}
|
||||
|
||||
@@ -45,3 +45,31 @@ bb3:
|
||||
%ret = tuple ()
|
||||
return %ret : $()
|
||||
}
|
||||
|
||||
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>} {
|
||||
bb0(%0 : $*Pack{repeat Wrapper<each T>}, %1 : $*Pack{repeat Wrapper<each T>}):
|
||||
%zero = integer_literal $Builtin.Word, 0
|
||||
%one = integer_literal $Builtin.Word, 1
|
||||
%len = pack_length $Pack{repeat each T}
|
||||
br bb1(%zero : $Builtin.Word)
|
||||
|
||||
bb1(%idx : $Builtin.Word):
|
||||
%done = builtin "cmp_eq_Word"(%idx : $Builtin.Word, %len : $Builtin.Word) : $Builtin.Int1 // user: %10
|
||||
cond_br %done, bb3, bb2
|
||||
|
||||
bb2:
|
||||
%pi = dynamic_pack_index %idx of $Pack{repeat Wrapper<each T>}
|
||||
%opening = open_pack_element %pi of <each T> at <Pack{repeat each T}>, shape $T, uuid "31FF306C-BF88-11ED-A03F-ACDE48001123"
|
||||
%in = pack_element_get %pi of %0 : $*Pack{repeat Wrapper<each T>} as $*Wrapper<@pack_element("31FF306C-BF88-11ED-A03F-ACDE48001123") T>
|
||||
%out = pack_element_get %pi of %1 : $*Pack{repeat Wrapper<each T>} as $*Wrapper<@pack_element("31FF306C-BF88-11ED-A03F-ACDE48001123") T>
|
||||
// Make sure that these don't crash.
|
||||
retain_value_addr %in : $*Wrapper<@pack_element("31FF306C-BF88-11ED-A03F-ACDE48001123") T>
|
||||
release_value_addr %in : $*Wrapper<@pack_element("31FF306C-BF88-11ED-A03F-ACDE48001123") T>
|
||||
copy_addr %in to [init] %out : $*Wrapper<@pack_element("31FF306C-BF88-11ED-A03F-ACDE48001123") T>
|
||||
%next = builtin "add_Word"(%idx : $Builtin.Word, %one : $Builtin.Word) : $Builtin.Word
|
||||
br bb1(%next : $Builtin.Word)
|
||||
|
||||
bb3:
|
||||
%ret = tuple ()
|
||||
return %ret : $()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user