@@ -15,6 +15,11 @@ struct Str {
15
15
@_hasStorage var b: Buffer { get set }
16
16
}
17
17
18
+ struct BufferAndBool {
19
+ @_hasStorage var b: Buffer { get set }
20
+ @_hasStorage var x: Bool { get set }
21
+ }
22
+
18
23
sil @unknown : $@convention(thin) (@guaranteed Buffer) -> ()
19
24
20
25
// CHECK-LABEL: sil @test_simple
@@ -109,6 +114,29 @@ bb2:
109
114
return %t : $(Builtin.Int1, Buffer)
110
115
}
111
116
117
+ // CHECK-LABEL: sil @test_cond_br_condition
118
+ // CHECK: [[I:%[0-9]+]] = integer_literal $Builtin.Int1, -1
119
+ // CHECK: ({{.*}}, [[B:%[0-9]+]]) = begin_cow_mutation
120
+ // CHECK: [[T:%[0-9]+]] = tuple ([[I]] : $Builtin.Int1, [[B]] : $Buffer)
121
+ // CHECK: return [[T]]
122
+ // CHECK: } // end sil function 'test_cond_br_condition'
123
+ sil @test_cond_br_condition : $@convention(thin) (@owned Buffer, Bool) -> (Builtin.Int1, @owned Buffer) {
124
+ bb0(%0 : $Buffer, %1 : $Bool):
125
+ %e = end_cow_mutation %0 : $Buffer
126
+ %s1 = struct $BufferAndBool (%e: $Buffer, %1 : $Bool)
127
+ %x = struct_extract %s1 : $BufferAndBool, #BufferAndBool.x
128
+ %c = struct_extract %x : $Bool, #Bool._value
129
+ cond_br %c, bb1, bb2
130
+ bb1:
131
+ br bb3
132
+ bb2:
133
+ br bb3
134
+ bb3:
135
+ (%u, %b) = begin_cow_mutation %e : $Buffer
136
+ %t = tuple (%u : $Builtin.Int1, %b : $Buffer)
137
+ return %t : $(Builtin.Int1, Buffer)
138
+ }
139
+
112
140
// CHECK-LABEL: sil @not_all_incoming_values_are_end_cow_mutation
113
141
// CHECK: ([[U:%[0-9]+]], {{.*}}) = begin_cow_mutation
114
142
// CHECK: [[B:%[0-9]+]] = end_cow_mutation
0 commit comments