@@ -21,13 +21,16 @@ struct M4: ~Copyable {
21
21
let s4: M
22
22
}
23
23
24
+ class C {}
25
+
24
26
sil @get_M4 : $@convention(thin) () -> @owned M4
25
27
sil @end_2 : $@convention(thin) (@owned M, @owned M) -> ()
26
28
sil @see_addr : $@convention(thin) (@in_guaranteed M) -> ()
27
29
sil @see_addr_2 : $@convention(thin) (@in_guaranteed M, @in_guaranteed M) -> ()
28
30
sil @replace_2 : $@convention(thin) (@inout M, @inout M) -> ()
29
31
sil @get_out_2 : $@convention(thin) () -> (@out M, @out M)
30
32
sil @take_addr_2 : $@convention(thin) (@in M, @in M) -> ()
33
+ sil @getC : $@convention(thin) () -> (@owned C)
31
34
32
35
/// Two non-contiguous fields (#M4.s2, #M4.s4) are borrowed by @see_addr_2.
33
36
/// Two non-contiguous fields (#M4.s1, #M$.s3) are consumed by @end_2.
@@ -253,3 +256,40 @@ bb0(%0 : @guaranteed $M):
253
256
return %retval : $()
254
257
}
255
258
259
+ // CHECK-LABEL: sil [ossa] @rdar130427564 : {{.*}} {
260
+ // Verify that no instructions were inserted after backedge2's terminator. (In
261
+ // fact, if they were, the test would crash.)
262
+ // CHECK: bb2([[C0:%[^,]+]] : @owned $C, [[B0:%[^,]+]] : @reborrow @guaranteed $C):
263
+ // CHECK-NEXT: [[B0F:%[^,]+]] = borrowed [[B0]] : $C from ([[C0]] : $C)
264
+ // CHECK-NEXT: end_borrow [[B0F]]
265
+ // CHECK-NEXT: destroy_value [[C0]]
266
+ // CHECK-NEXT: br
267
+ // CHECK-LABEL: } // end sil function 'rdar130427564'
268
+ sil [ossa] @rdar130427564 : $@convention(thin) (@in_guaranteed M) -> () {
269
+ entry(%ignore_me : $*M):
270
+ %ignore_me_2 = mark_unresolved_non_copyable_value [no_consume_or_assign] %ignore_me : $*M
271
+ br fn
272
+ fn:
273
+ %getC = function_ref @getC : $@convention(thin) () -> (@owned C)
274
+ %c = apply %getC() : $@convention(thin) () -> (@owned C)
275
+ %b = begin_borrow %c : $C
276
+ br header(%c : $C, %b : $C)
277
+ header(%c0 : @owned $C, %b0 : @reborrow @guaranteed $C):
278
+ %b0f = borrowed %b0 : $C from (%c0 : $C)
279
+ end_borrow %b0f : $C
280
+ destroy_value %c0 : $C
281
+ br body
282
+ body:
283
+ br latch
284
+ latch:
285
+ cond_br undef, backedge, ecit
286
+ backedge:
287
+ %c1 = apply %getC() : $@convention(thin) () -> (@owned C)
288
+ %b1 = begin_borrow %c1 : $C
289
+ br backedge2(%c1 : $C, %b1 : $C)
290
+ backedge2(%c2 : @owned $C, %b2 : @reborrow @guaranteed $C):
291
+ %b2f = borrowed %b2 : $C from (%c2 : $C)
292
+ br header(%c2 : $C, %b2f : $C)
293
+ ecit:
294
+ unreachable
295
+ }
0 commit comments