@@ -523,3 +523,44 @@ bb3:
523523bb4:
524524 return %1 : $Builtin.RawPointer
525525}
526+
527+ // CHECK-LABEL: sil [ossa] @looprotate_copy :
528+ // CHECK: bb0(%0 : $Int32, %1 : @guaranteed $Bar):
529+ // CHECK: copy_value
530+ // CHECK: cond_br {{.*}}, bb2, bb1
531+ // CHECK: copy_value
532+ // CHECK-LABEL: } // end sil function 'looprotate_copy'
533+ sil [ossa] @looprotate_copy : $@convention(thin) (Int32, @guaranteed Bar) -> Int32 {
534+ bb0(%0 : $Int32, %1 : @guaranteed $Bar):
535+ %2 = struct_extract %0 : $Int32, #Int32._value
536+ %3 = integer_literal $Builtin.Int32, 0
537+ br bb1(%2 : $Builtin.Int32, %3 : $Builtin.Int32)
538+
539+ bb1(%5 : $Builtin.Int32, %6 : $Builtin.Int32):
540+ %7 = copy_value %1 : $Bar
541+ %8 = class_method %7 : $Bar, #Bar.foo : (Bar) -> () -> (), $@convention(method) (@guaranteed Bar) -> ()
542+ %9 = apply %8(%7) : $@convention(method) (@guaranteed Bar) -> ()
543+ %10 = struct $Int32 (%6 : $Builtin.Int32)
544+ %11 = builtin "cmp_eq_Word"(%6 : $Builtin.Int32, %2 : $Builtin.Int32) : $Builtin.Int1
545+ cond_br %11, bb3, bb2
546+
547+ bb2:
548+ destroy_value %7 : $Bar
549+ %14 = integer_literal $Builtin.Int32, 1
550+ %15 = integer_literal $Builtin.Int1, -1
551+ %16 = builtin "sadd_with_overflow_Word"(%6 : $Builtin.Int32, %14 : $Builtin.Int32, %15 : $Builtin.Int1) : $(Builtin.Int32, Builtin.Int1)
552+ %17 = tuple_extract %16 : $(Builtin.Int32, Builtin.Int1), 0
553+ %18 = enum $Optional<Int32>, #Optional.some!enumelt, %10 : $Int32
554+ %19 = unchecked_enum_data %18 : $Optional<Int32>, #Optional.some!enumelt
555+ %20 = struct_extract %19 : $Int32, #Int32._value
556+ %21 = integer_literal $Builtin.Int1, -1
557+ %22 = builtin "sadd_with_overflow_Word"(%5 : $Builtin.Int32, %20 : $Builtin.Int32, %21 : $Builtin.Int1) : $(Builtin.Int32, Builtin.Int1)
558+ %23 = tuple_extract %22 : $(Builtin.Int32, Builtin.Int1), 0
559+ br bb1(%23 : $Builtin.Int32, %17 : $Builtin.Int32)
560+
561+ bb3:
562+ destroy_value %7 : $Bar
563+ %26 = struct $Int32 (%5 : $Builtin.Int32)
564+ return %26 : $Int32
565+ }
566+
0 commit comments