@@ -525,28 +525,35 @@ bb4:
525525 return %1 : $Builtin.RawPointer
526526}
527527
528- // CHECK-LABEL: sil [ossa] @looprotate_copy :
528+ // CHECK-LABEL: sil [ossa] @looprotate_copy_move_borrow :
529529// CHECK: bb0(%0 : $Int32, %1 : @guaranteed $Bar):
530530// CHECK: copy_value
531+ // CHECK: move_value
532+ // CHECK: begin_borrow
531533// CHECK: cond_br {{.*}}, bb2, bb1
532534// CHECK: copy_value
533- // CHECK-LABEL: } // end sil function 'looprotate_copy'
534- sil [ossa] @looprotate_copy : $@convention(thin) (Int32, @guaranteed Bar) -> Int32 {
535+ // CHECK: move_value
536+ // CHECK: begin_borrow
537+ // CHECK-LABEL: } // end sil function 'looprotate_copy_move_borrow'
538+ sil [ossa] @looprotate_copy_move_borrow : $@convention(thin) (Int32, @guaranteed Bar) -> Int32 {
535539bb0(%0 : $Int32, %1 : @guaranteed $Bar):
536540 %2 = struct_extract %0 : $Int32, #Int32._value
537541 %3 = integer_literal $Builtin.Int32, 0
538542 br bb1(%2 : $Builtin.Int32, %3 : $Builtin.Int32)
539543
540544bb1(%5 : $Builtin.Int32, %6 : $Builtin.Int32):
541- %7 = copy_value %1 : $Bar
545+ %c = copy_value %1 : $Bar
546+ %m = move_value %c : $Bar
547+ %7 = begin_borrow %m : $Bar
542548 %8 = class_method %7 : $Bar, #Bar.foo : (Bar) -> () -> (), $@convention(method) (@guaranteed Bar) -> ()
543549 %9 = apply %8(%7) : $@convention(method) (@guaranteed Bar) -> ()
544550 %10 = struct $Int32 (%6 : $Builtin.Int32)
545551 %11 = builtin "cmp_eq_Word"(%6 : $Builtin.Int32, %2 : $Builtin.Int32) : $Builtin.Int1
546552 cond_br %11, bb3, bb2
547553
548554bb2:
549- destroy_value %7 : $Bar
555+ end_borrow %7 : $Bar
556+ destroy_value %m : $Bar
550557 %14 = integer_literal $Builtin.Int32, 1
551558 %15 = integer_literal $Builtin.Int1, -1
552559 %16 = builtin "sadd_with_overflow_Word"(%6 : $Builtin.Int32, %14 : $Builtin.Int32, %15 : $Builtin.Int1) : $(Builtin.Int32, Builtin.Int1)
560567 br bb1(%23 : $Builtin.Int32, %17 : $Builtin.Int32)
561568
562569bb3:
563- destroy_value %7 : $Bar
570+ end_borrow %7 : $Bar
571+ destroy_value %m : $Bar
564572 %26 = struct $Int32 (%5 : $Builtin.Int32)
565573 return %26 : $Int32
566574}
0 commit comments