@@ -4953,3 +4953,35 @@ bb0(%0 : $*Klass, %1 : @owned $Klass):
4953
4953
return %9999 : $()
4954
4954
}
4955
4955
4956
+ class KlassWithTailAllocatedElems {
4957
+ var x : Builtin.NativeObject
4958
+ init()
4959
+ }
4960
+
4961
+ // CHECK-LABEL: sil [ossa] @unchecked_addr_cast_formation_handling_interior_pointer_rebase_of_cast : $@convention(thin) () -> Builtin.Word {
4962
+ // CHECK-NOT: pointer_to_address
4963
+ // CHECK-NOT: address_to_pointer
4964
+ // CHECK: [[TAIL_ADDR:%.*]] = ref_tail_addr
4965
+ // CHECK-NOT: pointer_to_address
4966
+ // CHECK-NOT: address_to_pointer
4967
+ // CHECK: [[CAST_RESULT:%.*]] = unchecked_addr_cast [[TAIL_ADDR]]
4968
+ // CHECK-NOT: pointer_to_address
4969
+ // CHECK-NOT: address_to_pointer
4970
+ // CHECK: load [trivial] [[CAST_RESULT]]
4971
+ // CHECK-NOT: pointer_to_address
4972
+ // CHECK-NOT: address_to_pointer
4973
+ // CHECK: } // end sil function 'unchecked_addr_cast_formation_handling_interior_pointer_rebase_of_cast'
4974
+ sil [ossa] @unchecked_addr_cast_formation_handling_interior_pointer_rebase_of_cast : $@convention(thin) () -> Builtin.Word {
4975
+ bb0:
4976
+ %7 = integer_literal $Builtin.Word, 1
4977
+ %8 = alloc_ref [tail_elems $(Builtin.NativeObject) * %7 : $Builtin.Word] $KlassWithTailAllocatedElems
4978
+ %borrow = begin_borrow %8 : $KlassWithTailAllocatedElems
4979
+ %addr = ref_tail_addr %borrow : $KlassWithTailAllocatedElems, $Builtin.NativeObject
4980
+ %1 = address_to_pointer %addr : $*Builtin.NativeObject to $Builtin.RawPointer
4981
+ end_borrow %borrow : $KlassWithTailAllocatedElems
4982
+ %2 = pointer_to_address %1 : $Builtin.RawPointer to [strict] $*Builtin.Word
4983
+ %3 = load [trivial] %2 : $*Builtin.Word
4984
+ destroy_value %8 : $KlassWithTailAllocatedElems
4985
+ return %3 : $Builtin.Word
4986
+ }
4987
+
0 commit comments