@@ -505,20 +505,45 @@ bb0(%0 : $*Builtin.Word, %1 : $Builtin.RawPointer):
505
505
return %7 : $(Builtin.Word, Builtin.RawPointer)
506
506
}
507
507
508
- // CHECK-LABEL: sil [ossa] @a2p_p2a_reinterpret_cast_word_raw_pointer
508
+ // CHECK-LABEL: sil [ossa] @a2p_p2a_reinterpret_cast_word_raw_pointer1
509
509
// CHECK: bb0
510
510
// CHECK-NEXT: unchecked_addr_cast
511
511
// CHECK-NEXT: load
512
512
// CHECK-NEXT: return
513
- // CHECK: } // end sil function 'a2p_p2a_reinterpret_cast_word_raw_pointer '
514
- sil [ossa] @a2p_p2a_reinterpret_cast_word_raw_pointer : $@convention(thin) (@inout Builtin.Word, Builtin.RawPointer) -> Int32 {
513
+ // CHECK: } // end sil function 'a2p_p2a_reinterpret_cast_word_raw_pointer1 '
514
+ sil [ossa] @a2p_p2a_reinterpret_cast_word_raw_pointer1 : $@convention(thin) (@inout Builtin.Word, Builtin.RawPointer) -> Int32 {
515
515
bb0(%0 : $*Builtin.Word, %1 : $Builtin.RawPointer):
516
516
%2 = address_to_pointer %0 : $*Builtin.Word to $Builtin.RawPointer
517
517
%3 = pointer_to_address %2 : $Builtin.RawPointer to [strict] $*Int32
518
518
%4 = load [trivial] %3 : $*Int32
519
519
return %4 : $Int32
520
520
}
521
521
522
+ sil @useInt : $@convention(thin) (Int32) -> ()
523
+
524
+ // CHECK-LABEL: sil [ossa] @a2p_p2a_reinterpret_cast_word_raw_pointer2
525
+ // CHECK: unchecked_addr_cast
526
+ // CHECK: } // end sil function 'a2p_p2a_reinterpret_cast_word_raw_pointer2'
527
+ sil [ossa] @a2p_p2a_reinterpret_cast_word_raw_pointer2 : $@convention(thin) (@owned ContiguousArray<UInt16>) -> () {
528
+ bb0(%0 : @owned $ContiguousArray<UInt16>):
529
+ %1 = begin_borrow %0 : $ContiguousArray<UInt16>
530
+ %2 = struct_extract %1 : $ContiguousArray<UInt16>, #ContiguousArray._buffer
531
+ %3 = struct_extract %2 : $_ContiguousArrayBuffer<UInt16>, #_ContiguousArrayBuffer._storage
532
+ %4 = ref_tail_addr %3 : $__ContiguousArrayStorageBase, $UInt16
533
+ %5 = address_to_pointer %4 : $*UInt16 to $Builtin.RawPointer
534
+ br bb1
535
+
536
+ bb1:
537
+ %6 = pointer_to_address %5 : $Builtin.RawPointer to [strict] $*Int32
538
+ %7 = load [trivial] %6 : $*Int32
539
+ %8 = function_ref @useInt : $@convention(thin) (Int32) -> ()
540
+ %9 = apply %8(%7) : $@convention(thin) (Int32) -> ()
541
+ end_borrow %1 : $ContiguousArray<UInt16>
542
+ destroy_value %0 : $ContiguousArray<UInt16>
543
+ %12 = tuple ()
544
+ return %12 : $()
545
+ }
546
+
522
547
// CHECK-LABEL: sil [ossa] @sil_extract_of_string
523
548
//
524
549
// Make sure we only forward the first field of the string_literal
0 commit comments