@@ -1075,3 +1075,52 @@ bb0(%0 : @owned $GS<Builtin.NativeObject>):
1075
1075
%v = tuple ()
1076
1076
return %v : $()
1077
1077
}
1078
+
1079
+ ////////////////////////////////////////
1080
+ // Unchecked Take Enum Data Addr Inst //
1081
+ ////////////////////////////////////////
1082
+
1083
+ // Make sure we only handle this in the copy_addr case. With time, we should
1084
+ // also handle the store case.
1085
+ //
1086
+ // CHECK-LABEL: sil [ossa] @unchecked_take_enum_data_addr_rvalue_simple : $@convention(thin) <B> (@in_guaranteed Optional<GS<B>>, @inout Optional<GS<B>>) -> () {
1087
+ // CHECK-NOT: alloc_stack
1088
+ // CHECK: } // end sil function 'unchecked_take_enum_data_addr_rvalue_simple'
1089
+ sil [ossa] @unchecked_take_enum_data_addr_rvalue_simple : $@convention(thin) <B> (@in_guaranteed Optional<GS<B>>, @inout Optional<GS<B>>) -> () {
1090
+ bb0(%0 : $*Optional<GS<B>>, %1 : $*Optional<GS<B>>):
1091
+ %0a = unchecked_take_enum_data_addr %0 : $*Optional<GS<B>>, #Optional.some!enumelt.1
1092
+ %2 = struct_element_addr %0a : $*GS<B>, #GS._value
1093
+ %3 = load [trivial] %2 : $*Builtin.Int64
1094
+ %4 = alloc_stack $Optional<GS<B>>
1095
+ copy_addr %1 to [initialization] %4 : $*Optional<GS<B>>
1096
+ %4a = unchecked_take_enum_data_addr %4 : $*Optional<GS<B>>, #Optional.some!enumelt.1
1097
+ %6 = struct_element_addr %4a : $*GS<B>, #GS._value
1098
+ %7 = load [trivial] %6 : $*Builtin.Int64
1099
+ %8 = builtin "cmp_slt_Int64"(%3 : $Builtin.Int64, %7 : $Builtin.Int64) : $Builtin.Int1
1100
+ destroy_addr %4 : $*Optional<GS<B>>
1101
+ dealloc_stack %4 : $*Optional<GS<B>>
1102
+ %9999 = tuple()
1103
+ return %9999 : $()
1104
+ }
1105
+
1106
+ // We do not support this today, since I am still bringing up store support.
1107
+ //
1108
+ // CHECK-LABEL: sil [ossa] @unchecked_take_enum_data_addr_store_rvalue_simple : $@convention(thin) (@in_guaranteed Optional<GS<Klass>>, @owned Optional<GS<Klass>>) -> () {
1109
+ // CHECK: alloc_stack
1110
+ // CHECK: } // end sil function 'unchecked_take_enum_data_addr_store_rvalue_simple'
1111
+ sil [ossa] @unchecked_take_enum_data_addr_store_rvalue_simple : $@convention(thin) (@in_guaranteed Optional<GS<Klass>>, @owned Optional<GS<Klass>>) -> () {
1112
+ bb0(%0 : $*Optional<GS<Klass>>, %1 : @owned $Optional<GS<Klass>>):
1113
+ %0a = unchecked_take_enum_data_addr %0 : $*Optional<GS<Klass>>, #Optional.some!enumelt.1
1114
+ %2 = struct_element_addr %0a : $*GS<Klass>, #GS._value
1115
+ %3 = load [trivial] %2 : $*Builtin.Int64
1116
+ %4 = alloc_stack $Optional<GS<Klass>>
1117
+ store %1 to [init] %4 : $*Optional<GS<Klass>>
1118
+ %4a = unchecked_take_enum_data_addr %4 : $*Optional<GS<Klass>>, #Optional.some!enumelt.1
1119
+ %6 = struct_element_addr %4a : $*GS<Klass>, #GS._value
1120
+ %7 = load [trivial] %6 : $*Builtin.Int64
1121
+ %8 = builtin "cmp_slt_Int64"(%3 : $Builtin.Int64, %7 : $Builtin.Int64) : $Builtin.Int1
1122
+ destroy_addr %4 : $*Optional<GS<Klass>>
1123
+ dealloc_stack %4 : $*Optional<GS<Klass>>
1124
+ %9999 = tuple()
1125
+ return %9999 : $()
1126
+ }
0 commit comments