@@ -5020,3 +5020,66 @@ bb0:
5020
5020
return %3 : $Builtin.Word
5021
5021
}
5022
5022
5023
+ struct Function {
5024
+ var impl: (MyInt) -> Double
5025
+ }
5026
+
5027
+ sil @negateFunction : $@convention(thin) (MyInt, @guaranteed Function) -> Double
5028
+
5029
+ // CHECK-LABEL: sil [ossa] @test_borrow_struct_extract : $@convention(thin) (@guaranteed Function) -> Double {
5030
+ // CHECK-NOT: struct_extract
5031
+ // CHECK-NOT: struct $Function
5032
+ // CHECK: } // end sil function 'test_borrow_struct_extract'
5033
+ sil [ossa] @test_borrow_struct_extract : $@convention(thin) (@guaranteed Function) -> Double {
5034
+ bb0(%0 : @guaranteed $Function):
5035
+ %3 = function_ref @negateFunction : $@convention(thin) (MyInt, @guaranteed Function) -> Double
5036
+ %4 = copy_value %0 : $Function
5037
+ %5 = partial_apply [callee_guaranteed] %3(%4) : $@convention(thin) (MyInt, @guaranteed Function) -> Double
5038
+ %6 = struct $Function (%5 : $@callee_guaranteed (MyInt) -> Double)
5039
+ %7 = integer_literal $Builtin.Int32, 0
5040
+ %8 = struct $MyInt (%7 : $Builtin.Int32)
5041
+ %9 = begin_borrow %6 : $Function
5042
+ %12 = struct_extract %9 : $Function, #Function.impl
5043
+ %13 = apply %12(%8) : $@callee_guaranteed (MyInt) -> Double
5044
+ end_borrow %9 : $Function
5045
+ destroy_value %6 : $Function
5046
+ return %13 : $Double
5047
+ }
5048
+
5049
+ // CHECK-LABEL: sil [ossa] @test_borrow_tuple_extract : $@convention(thin) (@guaranteed Function) -> Double {
5050
+ // CHECK-NOT: tuple_extract
5051
+ // CHECK: } // end sil function 'test_borrow_tuple_extract'
5052
+ sil [ossa] @test_borrow_tuple_extract : $@convention(thin) (@guaranteed Function) -> Double {
5053
+ bb0(%0 : @guaranteed $Function):
5054
+ %3 = function_ref @negateFunction : $@convention(thin) (MyInt, @guaranteed Function) -> Double
5055
+ %4 = copy_value %0 : $Function
5056
+ %5 = partial_apply [callee_guaranteed] %3(%4) : $@convention(thin) (MyInt, @guaranteed Function) -> Double
5057
+ %7 = integer_literal $Builtin.Int32, 0
5058
+ %8 = struct $MyInt (%7 : $Builtin.Int32)
5059
+ %6 = tuple (%5 : $@callee_guaranteed (MyInt) -> Double, %7 : $Builtin.Int32)
5060
+ %9 = begin_borrow %6 : $(@callee_guaranteed (MyInt) -> Double, Builtin.Int32)
5061
+ %12 = tuple_extract %9 : $(@callee_guaranteed (MyInt) -> Double, Builtin.Int32), 0
5062
+ %13 = apply %12(%8) : $@callee_guaranteed (MyInt) -> Double
5063
+ end_borrow %9 : $(@callee_guaranteed (MyInt) -> Double, Builtin.Int32)
5064
+ destroy_value %6 : $(@callee_guaranteed (MyInt) -> Double, Builtin.Int32)
5065
+ return %13 : $Double
5066
+ }
5067
+
5068
+ // CHECK-LABEL: sil [ossa] @test_borrow_unchecked_enum_data : $@convention(thin) (@guaranteed Function) -> Double {
5069
+ // CHECK-NOT: unchecked_enum_data
5070
+ // CHECK: } // end sil function 'test_borrow_unchecked_enum_data'
5071
+ sil [ossa] @test_borrow_unchecked_enum_data : $@convention(thin) (@guaranteed Function) -> Double {
5072
+ bb0(%0 : @guaranteed $Function):
5073
+ %3 = function_ref @negateFunction : $@convention(thin) (MyInt, @guaranteed Function) -> Double
5074
+ %4 = copy_value %0 : $Function
5075
+ %5 = partial_apply [callee_guaranteed] %3(%4) : $@convention(thin) (MyInt, @guaranteed Function) -> Double
5076
+ %7 = integer_literal $Builtin.Int32, 0
5077
+ %8 = struct $MyInt (%7 : $Builtin.Int32)
5078
+ %6 = enum $Optional<@callee_guaranteed (MyInt) -> Double>, #Optional.some!enumelt, %5 : $@callee_guaranteed (MyInt) -> Double
5079
+ %9 = begin_borrow %6 : $Optional<@callee_guaranteed (MyInt) -> Double>
5080
+ %12 = unchecked_enum_data %9 : $Optional<@callee_guaranteed (MyInt) -> Double>, #Optional.some!enumelt
5081
+ %13 = apply %12(%8) : $@callee_guaranteed (MyInt) -> Double
5082
+ end_borrow %9 : $Optional<@callee_guaranteed (MyInt) -> Double>
5083
+ destroy_value %6 : $Optional<@callee_guaranteed (MyInt) -> Double>
5084
+ return %13 : $Double
5085
+ }
0 commit comments