@@ -512,6 +512,8 @@ static SILValue scalarizeLoad(LoadInst *LI,
512
512
513
513
namespace {
514
514
515
+ // / Gathers information about a specific address and its uses to determine
516
+ // / definite initialization.
515
517
class ElementUseCollector {
516
518
SILModule &Module;
517
519
const DIMemoryObjectInfo &TheMemory;
@@ -587,8 +589,6 @@ class ElementUseCollector {
587
589
void addElementUses (unsigned BaseEltNo, SILType UseTy, SILInstruction *User,
588
590
DIUseKind Kind);
589
591
void collectTupleElementUses (TupleElementAddrInst *TEAI, unsigned BaseEltNo);
590
- void collectDestructureTupleResultUses (DestructureTupleResult *DTR,
591
- unsigned BaseEltNo);
592
592
void collectStructElementUses (StructElementAddrInst *SEAI,
593
593
unsigned BaseEltNo);
594
594
};
@@ -640,34 +640,6 @@ void ElementUseCollector::collectTupleElementUses(TupleElementAddrInst *TEAI,
640
640
collectUses (TEAI, BaseEltNo);
641
641
}
642
642
643
- // / Given a destructure_tuple, compute the new BaseEltNo implicit in the
644
- // / selected member, and recursively add uses of the instruction.
645
- void ElementUseCollector::collectDestructureTupleResultUses (
646
- DestructureTupleResult *DTR, unsigned BaseEltNo) {
647
-
648
- // If we're walking into a tuple within a struct or enum, don't adjust the
649
- // BaseElt. The uses hanging off the tuple_element_addr are going to be
650
- // counted as uses of the struct or enum itself.
651
- if (InStructSubElement || InEnumSubElement)
652
- return collectUses (DTR, BaseEltNo);
653
-
654
- assert (!IsSelfOfNonDelegatingInitializer && " self doesn't have tuple type" );
655
-
656
- // tuple_element_addr P, 42 indexes into the current tuple element.
657
- // Recursively process its uses with the adjusted element number.
658
- unsigned FieldNo = DTR->getIndex ();
659
- auto T = DTR->getParent ()->getOperand ()->getType ();
660
- if (T.is <TupleType>()) {
661
- for (unsigned i = 0 ; i != FieldNo; ++i) {
662
- SILType EltTy = T.getTupleElementType (i);
663
- BaseEltNo += getElementCountRec (TypeExpansionContext (*DTR->getFunction ()),
664
- Module, EltTy, false );
665
- }
666
- }
667
-
668
- collectUses (DTR, BaseEltNo);
669
- }
670
-
671
643
void ElementUseCollector::collectStructElementUses (StructElementAddrInst *SEAI,
672
644
unsigned BaseEltNo) {
673
645
// Generally, we set the "InStructSubElement" flag and recursively process
@@ -733,15 +705,15 @@ void ElementUseCollector::collectUses(SILValue Pointer, unsigned BaseEltNo) {
733
705
continue ;
734
706
}
735
707
736
- // Look through begin_access and begin_borrow
737
- if (isa<BeginAccessInst>(User) || isa<BeginBorrowInst>(User) ) {
708
+ // Look through begin_access.
709
+ if (isa<BeginAccessInst>(User)) {
738
710
auto begin = cast<SingleValueInstruction>(User);
739
711
collectUses (begin, BaseEltNo);
740
712
continue ;
741
713
}
742
714
743
- // Ignore end_access and end_borrow .
744
- if (isa<EndAccessInst>(User) || isa<EndBorrowInst>(User) ) {
715
+ // Ignore end_access.
716
+ if (isa<EndAccessInst>(User)) {
745
717
continue ;
746
718
}
747
719
@@ -1114,9 +1086,6 @@ void ElementUseCollector::collectUses(SILValue Pointer, unsigned BaseEltNo) {
1114
1086
collectTupleElementUses (TEAI, BaseEltNo);
1115
1087
continue ;
1116
1088
}
1117
-
1118
- auto *DTRI = cast<DestructureTupleResult>(EltPtr);
1119
- collectDestructureTupleResultUses (DTRI, BaseEltNo);
1120
1089
}
1121
1090
}
1122
1091
}
0 commit comments