@@ -11,6 +11,10 @@ final class Buffer {
11
11
init()
12
12
}
13
13
14
+ struct Str {
15
+ @_hasStorage var b: Buffer { get set }
16
+ }
17
+
14
18
sil @unknown : $@convention(thin) (@guaranteed Buffer) -> ()
15
19
16
20
// CHECK-LABEL: sil @test_simple
@@ -92,11 +96,35 @@ bb0(%0 : $*Buffer):
92
96
sil @test_loop : $@convention(thin) (@owned Buffer) -> (Builtin.Int1, @owned Buffer) {
93
97
bb0(%0 : $Buffer):
94
98
%e = end_cow_mutation %0 : $Buffer
95
- br bb1(%e : $Buffer)
96
- bb1(%a : $Buffer):
97
- (%u, %b) = begin_cow_mutation %a : $Buffer
99
+ %s1 = struct $Str (%e: $Buffer)
100
+ br bb1(%s1 : $Str)
101
+ bb1(%a : $Str):
102
+ %as = struct_extract %a : $Str, #Str.b
103
+ (%u, %b) = begin_cow_mutation %as : $Buffer
98
104
%e2 = end_cow_mutation %b : $Buffer
99
- cond_br undef, bb1(%e2 : $Buffer), bb2
105
+ %s2 = struct $Str (%e2: $Buffer)
106
+ cond_br undef, bb1(%s2 : $Str), bb2
107
+ bb2:
108
+ %t = tuple (%u : $Builtin.Int1, %e2 : $Buffer)
109
+ return %t : $(Builtin.Int1, Buffer)
110
+ }
111
+
112
+ // CHECK-LABEL: sil @not_all_incoming_values_are_end_cow_mutation
113
+ // CHECK: ([[U:%[0-9]+]], {{.*}}) = begin_cow_mutation
114
+ // CHECK: [[B:%[0-9]+]] = end_cow_mutation
115
+ // CHECK: [[T:%[0-9]+]] = tuple ([[U]] : $Builtin.Int1, [[B]] : $Buffer)
116
+ // CHECK: return [[T]]
117
+ // CHECK: } // end sil function 'not_all_incoming_values_are_end_cow_mutation'
118
+ sil @not_all_incoming_values_are_end_cow_mutation : $@convention(thin) (@owned Buffer) -> (Builtin.Int1, @owned Buffer) {
119
+ bb0(%0 : $Buffer):
120
+ %s1 = struct $Str (%0: $Buffer)
121
+ br bb1(%s1 : $Str)
122
+ bb1(%a : $Str):
123
+ %as = struct_extract %a : $Str, #Str.b
124
+ (%u, %b) = begin_cow_mutation %as : $Buffer
125
+ %e2 = end_cow_mutation %b : $Buffer
126
+ %s2 = struct $Str (%e2: $Buffer)
127
+ cond_br undef, bb1(%s2 : $Str), bb2
100
128
bb2:
101
129
%t = tuple (%u : $Builtin.Int1, %e2 : $Buffer)
102
130
return %t : $(Builtin.Int1, Buffer)
0 commit comments