@@ -11,6 +11,10 @@ final class Buffer {
1111 init()
1212}
1313
14+ struct Str {
15+ @_hasStorage var b: Buffer { get set }
16+ }
17+
1418sil @unknown : $@convention(thin) (@guaranteed Buffer) -> ()
1519
1620// CHECK-LABEL: sil @test_simple
@@ -92,11 +96,35 @@ bb0(%0 : $*Buffer):
9296sil @test_loop : $@convention(thin) (@owned Buffer) -> (Builtin.Int1, @owned Buffer) {
9397bb0(%0 : $Buffer):
9498 %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
98104 %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
100128bb2:
101129 %t = tuple (%u : $Builtin.Int1, %e2 : $Buffer)
102130 return %t : $(Builtin.Int1, Buffer)
0 commit comments