Skip to content

Commit 5ace517

Browse files
authored
Merge pull request #23528 from gottesmm/pr-10fd632cb35af9aab94b1287b06df17a0e27f6be
2 parents a82e084 + 7b0309b commit 5ace517

11 files changed

+98
-100
lines changed

test/SIL/Parser/basic2.sil

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
import Builtin
44

55
// CHECK-LABEL: sil [ossa] @test_copy_release_value
6-
// CHECK: bb0([[T0:%[0-9]+]] : @unowned $Builtin.NativeObject):
6+
// CHECK: bb0([[T0:%[0-9]+]] : @owned $Builtin.NativeObject):
77
// CHECK-NEXT: [[COPY_RESULT:%.*]] = copy_value [[T0]] : $Builtin.NativeObject
88
// CHECK-NEXT: destroy_value [[T0]] : $Builtin.NativeObject
99
// CHECK-NEXT: return [[COPY_RESULT]]
10-
sil [ossa] @test_copy_release_value : $@convention(thin) (Builtin.NativeObject) -> Builtin.NativeObject {
11-
bb0(%0 : @unowned $Builtin.NativeObject):
10+
sil [ossa] @test_copy_release_value : $@convention(thin) (@owned Builtin.NativeObject) -> @owned Builtin.NativeObject {
11+
bb0(%0 : @owned $Builtin.NativeObject):
1212
%1 = copy_value %0 : $Builtin.NativeObject
1313
destroy_value %0 : $Builtin.NativeObject
1414
return %1 : $Builtin.NativeObject

test/SIL/Parser/borrow.sil

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,16 @@ sil_stage canonical
55
import Builtin
66

77
// We do not verify here, but just make sure that all of the combinations parse and print correctly.
8-
// CHECK-LABEL: sil [ossa] @borrow_test : $@convention(thin) (@in Builtin.NativeObject, Builtin.NativeObject) -> () {
9-
// CHECK: bb0([[ARG1:%[0-9]+]] : $*Builtin.NativeObject, [[ARG2:%[0-9]+]] : @unowned $Builtin.NativeObject):
10-
// CHECK: begin_borrow [[ARG2]]
8+
// CHECK-LABEL: sil [ossa] @borrow_test : $@convention(thin) (@in Builtin.NativeObject, @guaranteed Builtin.NativeObject) -> () {
9+
// CHECK: bb0([[ARG1:%[0-9]+]] : $*Builtin.NativeObject, [[ARG2:%[0-9]+]] : @guaranteed $Builtin.NativeObject):
10+
// CHECK: [[BORROWED_ARG2:%.*]] = begin_borrow [[ARG2]]
11+
// CHECK: end_borrow [[BORROWED_ARG2]]
1112
// CHECK: [[MEM:%.*]] = alloc_stack $Builtin.NativeObject
1213
// CHECK: store_borrow [[ARG2]] to [[MEM]] : $*Builtin.NativeObject
13-
// CHECK: end_borrow [[ARG1]] : $*Builtin.NativeObject
14-
// CHECK: end_borrow [[ARG2]] : $Builtin.NativeObject
15-
// CHECK: end_borrow [[ARG1]] : $*Builtin.NativeObject
16-
// CHECK: end_borrow [[ARG2]] : $Builtin.NativeObject
17-
sil [ossa] @borrow_test : $@convention(thin) (@in Builtin.NativeObject, Builtin.NativeObject) -> () {
18-
bb0(%0 : $*Builtin.NativeObject, %1 : @unowned $Builtin.NativeObject):
14+
// CHECK: end_borrow [[MEM]] : $*Builtin.NativeObject
15+
// CHECK: } // end sil function 'borrow_test'
16+
sil [ossa] @borrow_test : $@convention(thin) (@in Builtin.NativeObject, @guaranteed Builtin.NativeObject) -> () {
17+
bb0(%0 : $*Builtin.NativeObject, %1 : @guaranteed $Builtin.NativeObject):
1918
%2 = begin_borrow %1 : $Builtin.NativeObject
2019
end_borrow %2 : $Builtin.NativeObject
2120

@@ -24,10 +23,6 @@ bb0(%0 : $*Builtin.NativeObject, %1 : @unowned $Builtin.NativeObject):
2423
end_borrow %3 : $*Builtin.NativeObject
2524
dealloc_stack %3 : $*Builtin.NativeObject
2625

27-
end_borrow %0 : $*Builtin.NativeObject
28-
end_borrow %1 : $Builtin.NativeObject
29-
end_borrow %0 : $*Builtin.NativeObject
30-
end_borrow %1 : $Builtin.NativeObject
3126
%4 = tuple()
3227
return %4 : $()
3328
}

test/SIL/Parser/keypath.sil

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ struct T {
5050
let w: (Int, C)
5151
}
5252

53-
// CHECK-LABEL: sil shared [ossa] @stored_properties
54-
sil shared [ossa] @stored_properties : $@convention(thin) () -> () {
53+
// CHECK-LABEL: sil shared @stored_properties
54+
sil shared @stored_properties : $@convention(thin) () -> () {
5555
entry:
5656
// CHECK: keypath $WritableKeyPath<S, Int>, (root $S; stored_property #S.x : $Int)
5757
%a = keypath $WritableKeyPath<S, Int>, (root $S; stored_property #S.x : $Int)
@@ -65,8 +65,8 @@ entry:
6565
return undef : $()
6666
}
6767

68-
// CHECK-LABEL: sil shared [ossa] @stored_properties_generic
69-
sil shared [ossa] @stored_properties_generic : $@convention(thin) <D: P, E: Q, F: R> () -> () {
68+
// CHECK-LABEL: sil shared @stored_properties_generic
69+
sil shared @stored_properties_generic : $@convention(thin) <D: P, E: Q, F: R> () -> () {
7070
entry:
7171
// CHECK: keypath $WritableKeyPath<Gen<D, E, F>, D>, <τ_0_0, τ_0_1, τ_0_2 where {{.*}}> (root $Gen<τ_0_0, τ_0_1, τ_0_2>; stored_property #Gen.x : $τ_0_0) <D, E, F>
7272
%a = keypath $WritableKeyPath<Gen<D,E,F>, D>, <G: P, H: Q, I: R> (root $Gen<G, H, I>; stored_property #Gen.x : $G) <D, E, F>
@@ -76,8 +76,8 @@ entry:
7676
return undef : $()
7777
}
7878

79-
// CHECK-LABEL: sil shared [ossa] @tuple_elements
80-
sil shared [ossa] @tuple_elements : $@convention(thin) () -> () {
79+
// CHECK-LABEL: sil shared @tuple_elements
80+
sil shared @tuple_elements : $@convention(thin) () -> () {
8181
entry:
8282
// CHECK: keypath $WritableKeyPath<T, Int>, (root $T; stored_property #T.x : $(Int, Int); tuple_element #0 : $Int)
8383
%a = keypath $WritableKeyPath<T, Int>, (root $T; stored_property #T.x : $(Int, Int); tuple_element #0 : $Int)
@@ -108,8 +108,8 @@ sil @gen_subs_eq : $@convention(thin) <A: Hashable, B: Hashable, C: Hashable> (U
108108
sil @gen_subs_hash : $@convention(thin) <A: Hashable, B: Hashable, C: Hashable> (UnsafeRawPointer) -> Int
109109

110110

111-
// CHECK-LABEL: sil shared [ossa] @computed_properties
112-
sil shared [ossa] @computed_properties : $@convention(thin) () -> () {
111+
// CHECK-LABEL: sil shared @computed_properties
112+
sil shared @computed_properties : $@convention(thin) () -> () {
113113
entry:
114114
// CHECK: keypath $KeyPath<S, Int>, (root $S; gettable_property $Int, id @id_a : $@convention(thin) () -> (), getter @get_s_int : $@convention(thin) (@in_guaranteed S) -> @out Int)
115115
%a = keypath $KeyPath<S, Int>, (root $S; gettable_property $Int, id @id_a : $@convention(thin) () -> (), getter @get_s_int : $@convention(thin) (@in_guaranteed S) -> @out Int)
@@ -157,10 +157,10 @@ entry:
157157
return undef : $()
158158
}
159159

160-
// CHECK-LABEL: sil [ossa] @indexes
161-
sil [ossa] @indexes : $@convention(thin) (S, C) -> () {
162-
// CHECK: bb0([[S:%.*]] : @unowned $S, [[C:%.*]] : @unowned $C):
163-
entry(%s : @unowned $S, %c : @unowned $C):
160+
// CHECK-LABEL: sil @indexes
161+
sil @indexes : $@convention(thin) (S, C) -> () {
162+
// CHECK: bb0([[S:%.*]] : $S, [[C:%.*]] : $C):
163+
entry(%s : $S, %c : $C):
164164
// CHECK: keypath $KeyPath<S, Int>, (root $S; settable_property $Int, id @id_a : $@convention(thin) () -> (), getter @get_s_int_subs : $@convention(thin) (@in_guaranteed S, UnsafeRawPointer) -> @out Int, setter @set_s_int_subs : $@convention(thin) (@in_guaranteed Int, @in_guaranteed S, UnsafeRawPointer) -> (), indices [%$0 : $S : $S, %$1 : $C : $C], indices_equals @subs_eq : $@convention(thin) (UnsafeRawPointer, UnsafeRawPointer) -> Bool, indices_hash @subs_hash : $@convention(thin) (UnsafeRawPointer) -> Int) ([[S]], [[C]])
165165
%a = keypath $KeyPath<S, Int>, (root $S; settable_property $Int, id @id_a : $@convention(thin) () -> (), getter @get_s_int_subs : $@convention(thin) (@in_guaranteed S, UnsafeRawPointer) -> @out Int, setter @set_s_int_subs : $@convention(thin) (@in_guaranteed Int, @in_guaranteed S, UnsafeRawPointer) -> (), indices [%$0 : $S : $S, %$1 : $C : $C], indices_equals @subs_eq : $@convention(thin) (UnsafeRawPointer, UnsafeRawPointer) -> Bool, indices_hash @subs_hash : $@convention(thin) (UnsafeRawPointer) -> Int) (%s, %c)
166166
// CHECK: [[T:%.*]] = alloc_stack

test/SIL/Parser/ownership_qualified_memopts.sil

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,24 @@
33

44
import Builtin
55

6-
// CHECK-LABEL: sil [ossa] @non_trivial : $@convention(thin) (@in Builtin.NativeObject, Builtin.NativeObject) -> () {
7-
// CHECK: bb0([[ARG1:%[0-9]+]] : $*Builtin.NativeObject, [[ARG2:%[0-9]+]] : @unowned $Builtin.NativeObject):
6+
// CHECK-LABEL: sil [ossa] @non_trivial : $@convention(thin) (@in Builtin.NativeObject, @owned Builtin.NativeObject) -> () {
7+
// CHECK: bb0([[ARG1:%[0-9]+]] : $*Builtin.NativeObject, [[ARG2:%[0-9]+]] : @owned $Builtin.NativeObject):
88
// CHECK: load [take] [[ARG1]] : $*Builtin.NativeObject
99
// CHECK: load [copy] [[ARG1]] : $*Builtin.NativeObject
10-
// CHECK: store [[ARG2]] to [init] [[ARG1]] : $*Builtin.NativeObject
10+
// CHECK: [[COPY_ARG2:%.*]] = copy_value [[ARG2]]
11+
// CHECK: store [[COPY_ARG2]] to [init] [[ARG1]] : $*Builtin.NativeObject
1112
// CHECK: store [[ARG2]] to [assign] [[ARG1]] : $*Builtin.NativeObject
12-
sil [ossa] @non_trivial : $@convention(thin) (@in Builtin.NativeObject, Builtin.NativeObject) -> () {
13-
bb0(%0 : $*Builtin.NativeObject, %1 : @unowned $Builtin.NativeObject):
14-
load [take] %0 : $*Builtin.NativeObject
15-
load [copy] %0 : $*Builtin.NativeObject
16-
store %1 to [init] %0 : $*Builtin.NativeObject
13+
sil [ossa] @non_trivial : $@convention(thin) (@in Builtin.NativeObject, @owned Builtin.NativeObject) -> () {
14+
bb0(%0 : $*Builtin.NativeObject, %1 : @owned $Builtin.NativeObject):
15+
%2 = load [take] %0 : $*Builtin.NativeObject
16+
%3 = load [copy] %0 : $*Builtin.NativeObject
17+
%4 = copy_value %1 : $Builtin.NativeObject
18+
store %4 to [init] %0 : $*Builtin.NativeObject
1719
store %1 to [assign] %0 : $*Builtin.NativeObject
18-
%2 = tuple()
19-
return %2 : $()
20+
destroy_value %2 : $Builtin.NativeObject
21+
destroy_value %3 : $Builtin.NativeObject
22+
%9999 = tuple()
23+
return %9999 : $()
2024
}
2125

2226
// CHECK-LABEL: sil [ossa] @trivial_args : $@convention(thin) (@in Builtin.Int32, Builtin.Int32) -> () {

test/SIL/Parser/without_actually_escaping.sil

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ bb0(%0 : @guaranteed $@callee_guaranteed () -> ()):
1010
}
1111

1212
// Check that the convert_function [without_actually_escaping] attribute is parsed and printed.
13-
// CHECK-LABEL: sil hidden [ossa] @testWithoutActuallyEscapingBlock : $@convention(thin) (@guaranteed @convention(block) @noescape () -> ()) -> () {
13+
// CHECK-LABEL: sil hidden [ossa] @testWithoutActuallyEscapingBlock : $@convention(thin) (@owned @convention(block) @noescape () -> ()) -> () {
1414
// CHECK: convert_function %0 : $@convention(block) @noescape () -> () to [without_actually_escaping] $@convention(block) () -> ()
15-
sil hidden [ossa] @testWithoutActuallyEscapingBlock : $@convention(thin) (@guaranteed @convention(block) @noescape () -> ()) -> () {
16-
bb0(%0 : @guaranteed $@convention(block) @noescape () -> ()):
15+
sil hidden [ossa] @testWithoutActuallyEscapingBlock : $@convention(thin) (@owned @convention(block) @noescape () -> ()) -> () {
16+
bb0(%0 : @owned $@convention(block) @noescape () -> ()):
1717
%cvt = convert_function %0 : $@convention(block) @noescape () -> () to [without_actually_escaping] $@convention(block) () -> ()
1818
%f = function_ref @closure1 : $@convention(thin) (@guaranteed @convention(block) () -> ()) -> ()
1919
%call = apply %f(%cvt) : $@convention(thin) (@guaranteed @convention(block) () -> ()) -> ()

test/SIL/Serialization/assignattr.sil

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,16 @@ bb0(%0 : $*Builtin.Int32, %1 : $Builtin.Int32):
1818
return %2 : $()
1919
}
2020

21-
// CHECK-LABEL: sil [serialized] [ossa] @non_trivial_assign : $@convention(thin) (@in Builtin.NativeObject, Builtin.NativeObject) -> () {
22-
// CHECK: bb0([[ARG1:%[0-9]+]] : $*Builtin.NativeObject, [[ARG2:%[0-9]+]] : @unowned $Builtin.NativeObject):
23-
// CHECK: assign [[ARG2]] to [reassign] [[ARG1]] : $*Builtin.NativeObject
21+
// CHECK-LABEL: sil [serialized] [ossa] @non_trivial_assign : $@convention(thin) (@in Builtin.NativeObject, @owned Builtin.NativeObject) -> () {
22+
// CHECK: bb0([[ARG1:%[0-9]+]] : $*Builtin.NativeObject, [[ARG2:%[0-9]+]] : @owned $Builtin.NativeObject):
23+
// CHECK: [[ARG2_COPY:%.*]] = copy_value [[ARG2]]
24+
// CHECK: assign [[ARG2_COPY]] to [reassign] [[ARG1]] : $*Builtin.NativeObject
2425
// CHECK: assign [[ARG2]] to [reinit] [[ARG1]] : $*Builtin.NativeObject
25-
sil [serialized] [ossa] @non_trivial_assign : $@convention(thin) (@in Builtin.NativeObject, Builtin.NativeObject) -> () {
26-
bb0(%0 : $*Builtin.NativeObject, %1 : @unowned $Builtin.NativeObject):
27-
assign %1 to [reassign] %0 : $*Builtin.NativeObject
26+
sil [serialized] [ossa] @non_trivial_assign : $@convention(thin) (@in Builtin.NativeObject, @owned Builtin.NativeObject) -> () {
27+
bb0(%0 : $*Builtin.NativeObject, %1 : @owned $Builtin.NativeObject):
28+
%2 = copy_value %1 : $Builtin.NativeObject
29+
assign %2 to [reassign] %0 : $*Builtin.NativeObject
2830
assign %1 to [reinit] %0 : $*Builtin.NativeObject
29-
%2 = tuple()
30-
return %2 : $()
31+
%9999 = tuple()
32+
return %9999 : $()
3133
}

test/SIL/Serialization/basic.sil

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ import Builtin
1010
// CHECK: unchecked_ownership_conversion {{%.*}} : $Builtin.NativeObject, @guaranteed to @owned
1111
sil [serialized] [ossa] @test_unchecked_ownership_conversion : $@convention(thin) (@guaranteed Builtin.NativeObject) -> () {
1212
bb0(%0 : @guaranteed $Builtin.NativeObject):
13-
unchecked_ownership_conversion %0 : $Builtin.NativeObject, @guaranteed to @owned
13+
%1 = unchecked_ownership_conversion %0 : $Builtin.NativeObject, @guaranteed to @owned
14+
destroy_value %1 : $Builtin.NativeObject
1415
return undef : $()
1516
}
1617

test/SIL/Serialization/borrow.sil

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,29 +9,22 @@ sil_stage canonical
99
import Builtin
1010

1111
// We do not verify here, but just make sure that all of the combinations parse and print correctly.
12-
// CHECK-LABEL: sil [serialized] [ossa] @borrow_test : $@convention(thin) (@in Builtin.NativeObject, Builtin.NativeObject) -> () {
13-
// CHECK: bb0([[ARG1:%[0-9]+]] : $*Builtin.NativeObject, [[ARG2:%[0-9]+]] : @unowned $Builtin.NativeObject):
14-
// CHECK: begin_borrow [[ARG2]]
12+
// CHECK-LABEL: sil [serialized] [ossa] @borrow_test : $@convention(thin) (@in Builtin.NativeObject, @guaranteed Builtin.NativeObject) -> () {
13+
// CHECK: bb0([[ARG1:%[0-9]+]] : $*Builtin.NativeObject, [[ARG2:%[0-9]+]] : @guaranteed $Builtin.NativeObject):
14+
// CHECK: [[BORROWED_ARG2:%.*]] = begin_borrow [[ARG2]]
15+
// CHECK: end_borrow [[BORROWED_ARG2]]
1516
// CHECK: [[MEM:%.*]] = alloc_stack $Builtin.NativeObject
1617
// CHECK: store_borrow [[ARG2]] to [[MEM]] : $*Builtin.NativeObject
17-
// CHECK: end_borrow [[ARG1]] : $*Builtin.NativeObject
18-
// CHECK: end_borrow [[ARG2]] : $Builtin.NativeObject
19-
// CHECK: end_borrow [[ARG1]] : $*Builtin.NativeObject
20-
// CHECK: end_borrow [[ARG2]] : $Builtin.NativeObject
21-
sil [serialized] [ossa] @borrow_test : $@convention(thin) (@in Builtin.NativeObject, Builtin.NativeObject) -> () {
22-
bb0(%0 : $*Builtin.NativeObject, %1 : @unowned $Builtin.NativeObject):
18+
// CHECK: } // end sil function 'borrow_test'
19+
sil [serialized] [ossa] @borrow_test : $@convention(thin) (@in Builtin.NativeObject, @guaranteed Builtin.NativeObject) -> () {
20+
bb0(%0 : $*Builtin.NativeObject, %1 : @guaranteed $Builtin.NativeObject):
2321
%2 = begin_borrow %1 : $Builtin.NativeObject
2422
end_borrow %2 : $Builtin.NativeObject
2523

2624
%3 = alloc_stack $Builtin.NativeObject
2725
store_borrow %1 to %3 : $*Builtin.NativeObject
2826
end_borrow %3 : $*Builtin.NativeObject
2927
dealloc_stack %3 : $*Builtin.NativeObject
30-
31-
end_borrow %0 : $*Builtin.NativeObject
32-
end_borrow %1 : $Builtin.NativeObject
33-
end_borrow %0 : $*Builtin.NativeObject
34-
end_borrow %1 : $Builtin.NativeObject
3528
%4 = tuple()
3629
return %4 : $()
3730
}

0 commit comments

Comments
 (0)