@@ -231,10 +231,6 @@ class ElementUseCollector {
231
231
// / element we attribute an access to.
232
232
bool InStructSubElement = false ;
233
233
234
- // / When walking the use list, if we index into an enum slice, keep track
235
- // / of this.
236
- bool InEnumSubElement = false ;
237
-
238
234
public:
239
235
ElementUseCollector (const PMOMemoryObjectInfo &TheMemory,
240
236
SmallVectorImpl<PMOMemoryUse> &Uses,
@@ -294,7 +290,7 @@ void ElementUseCollector::addElementUses(unsigned BaseEltNo, SILType UseTy,
294
290
// If we're in a subelement of a struct or enum, just mark the struct, not
295
291
// things that come after it in a parent tuple.
296
292
unsigned NumElements = 1 ;
297
- if (TheMemory.NumElements != 1 && !InStructSubElement && !InEnumSubElement )
293
+ if (TheMemory.NumElements != 1 && !InStructSubElement)
298
294
NumElements = getElementCountRec (Module, UseTy);
299
295
300
296
Uses.push_back (PMOMemoryUse (User, Kind, BaseEltNo, NumElements));
@@ -309,7 +305,7 @@ bool ElementUseCollector::collectTupleElementUses(TupleElementAddrInst *TEAI,
309
305
// If we're walking into a tuple within a struct or enum, don't adjust the
310
306
// BaseElt. The uses hanging off the tuple_element_addr are going to be
311
307
// counted as uses of the struct or enum itself.
312
- if (InStructSubElement || InEnumSubElement )
308
+ if (InStructSubElement)
313
309
return collectUses (TEAI, BaseEltNo);
314
310
315
311
// tuple_element_addr P, 42 indexes into the current tuple element.
@@ -554,26 +550,6 @@ bool ElementUseCollector::collectUses(SILValue Pointer, unsigned BaseEltNo) {
554
550
llvm_unreachable (" bad parameter convention" );
555
551
}
556
552
557
- // init_enum_data_addr is treated like a tuple_element_addr or other
558
- // instruction that is looking into the memory object (i.e., the memory
559
- // object needs to be explicitly initialized by a copy_addr or some other
560
- // use of the projected address).
561
- if (auto I = dyn_cast<InitEnumDataAddrInst>(User)) {
562
- // If we are in a struct already, bail. With proper analysis, we should be
563
- // able to do this optimization.
564
- if (InStructSubElement) {
565
- return false ;
566
- }
567
-
568
- // Keep track of the fact that we're inside of an enum. This informs our
569
- // recursion that tuple stores are not scalarized outside, and that stores
570
- // should not be treated as partial stores.
571
- llvm::SaveAndRestore<bool > X (InEnumSubElement, true );
572
- if (!collectUses (I, BaseEltNo))
573
- return false ;
574
- continue ;
575
- }
576
-
577
553
// init_existential_addr is modeled as an initialization store.
578
554
if (isa<InitExistentialAddrInst>(User)) {
579
555
// init_existential_addr should not apply to struct subelements.
@@ -585,17 +561,6 @@ bool ElementUseCollector::collectUses(SILValue Pointer, unsigned BaseEltNo) {
585
561
continue ;
586
562
}
587
563
588
- // inject_enum_addr is modeled as an initialization store.
589
- if (isa<InjectEnumAddrInst>(User)) {
590
- // inject_enum_addr the subelement of a struct unless in a ctor.
591
- if (InStructSubElement) {
592
- return false ;
593
- }
594
- Uses.push_back (
595
- PMOMemoryUse (User, PMOUseKind::Initialization, BaseEltNo, 1 ));
596
- continue ;
597
- }
598
-
599
564
// open_existential_addr is a use of the protocol value,
600
565
// so it is modeled as a load.
601
566
if (isa<OpenExistentialAddrInst>(User)) {
0 commit comments