File tree Expand file tree Collapse file tree 3 files changed +31
-1
lines changed Expand file tree Collapse file tree 3 files changed +31
-1
lines changed Original file line number Diff line number Diff line change @@ -638,6 +638,13 @@ class AccessBase : public AccessRepresentation {
638638 return findOwnershipReferenceRoot (getReference ());
639639 }
640640
641+ // / Return the OSSA root of the reference being accessed
642+ // / looking through struct_extract, tuple_extract, etc.
643+ // / Precondition: isReference() is true.
644+ SILValue getOwnershipReferenceAggregate () const {
645+ return findOwnershipReferenceAggregate (getReference ());
646+ }
647+
641648 // / Return the storage root of the reference being accessed.
642649 // /
643650 // / Precondition: isReference() is true.
Original file line number Diff line number Diff line change @@ -1092,7 +1092,7 @@ bool AddressOwnership::areUsesWithinLifetime(
10921092 if (!base.hasLocalOwnershipLifetime ())
10931093 return true ;
10941094
1095- SILValue root = base.getOwnershipReferenceRoot ();
1095+ SILValue root = base.getOwnershipReferenceAggregate ();
10961096 BorrowedValue borrow (root);
10971097 if (borrow)
10981098 return borrow.areUsesWithinExtendedScope (uses, &deadEndBlocks);
Original file line number Diff line number Diff line change @@ -1010,3 +1010,26 @@ bb0:
10101010 return %t : $()
10111011}
10121012
1013+ // CHECK-LABEL: sil [ossa] @test_aggreate_tail_addr :
1014+ // CHECK: ref_tail_addr
1015+ // CHECK: ref_tail_addr
1016+ // CHECK-LABEL: } // end sil function 'test_aggreate_tail_addr'
1017+ sil [ossa] @test_aggreate_tail_addr : $@convention(thin) (@owned _NativeDictionary<Int, Klass>) -> () {
1018+ bb0(%0 : @owned $_NativeDictionary<Int, Klass>):
1019+ %49 = move_value [lexical] %0 : $_NativeDictionary<Int, Klass>
1020+ %50 = begin_borrow %49
1021+ %51 = struct_extract %50, #_NativeDictionary._storage
1022+ %52 = copy_value %51
1023+ %53 = ref_tail_addr %51, $_UnsafeBitset.Word
1024+ %59 = load [trivial] %53
1025+ end_borrow %50
1026+ %72 = begin_borrow %52
1027+ %73 = ref_tail_addr %72, $_UnsafeBitset.Word
1028+ %74 = struct_element_addr %73, #_UnsafeBitset.Word.value
1029+ %75 = struct_element_addr %74, #UInt._value
1030+ %76 = load [trivial] %75
1031+ end_borrow %72
1032+ destroy_value %52
1033+ destroy_value %49
1034+ unreachable
1035+ }
You can’t perform that action at this time.
0 commit comments