@@ -363,15 +363,6 @@ namespace {
363
363
// / plus the information merged-in from the predecessor blocks.
364
364
AvailabilitySet OutAvailability;
365
365
366
- // / Keep track of blocks where the contents of the self box are not valid
367
- // / because we're in an error path dominated by a self.init or super.init
368
- // / delegation.
369
- Optional<DIKind> LocalSelfConsumed;
370
-
371
- // / The live out information of the block. This is the LocalSelfConsumed
372
- // / plus the information merged-in from the predecessor blocks.
373
- Optional<DIKind> OutSelfConsumed;
374
-
375
366
// / Keep track of blocks where the contents of the self box are stored to
376
367
// / as a result of a successful self.init or super.init call.
377
368
Optional<DIKind> LocalSelfInitialized;
@@ -391,10 +382,6 @@ namespace {
391
382
void setUnknownToNotAvailable () {
392
383
LocalAvailability.changeUnsetElementsTo (DIKind::No);
393
384
OutAvailability.changeUnsetElementsTo (DIKind::No);
394
- if (!LocalSelfConsumed.hasValue ())
395
- LocalSelfConsumed = DIKind::No;
396
- if (!OutSelfConsumed.hasValue ())
397
- OutSelfConsumed = DIKind::No;
398
385
if (!LocalSelfInitialized.hasValue ())
399
386
LocalSelfInitialized = DIKind::No;
400
387
if (!OutSelfInitialized.hasValue ())
@@ -441,15 +428,6 @@ namespace {
441
428
}
442
429
}
443
430
444
- Optional<DIKind> temp;
445
- if (transferAvailability (Pred.OutSelfConsumed ,
446
- OutSelfConsumed,
447
- LocalSelfConsumed,
448
- temp)) {
449
- changed = true ;
450
- OutSelfConsumed = temp;
451
- }
452
-
453
431
Optional<DIKind> result;
454
432
if (transferAvailability (Pred.OutSelfInitialized ,
455
433
OutSelfInitialized,
@@ -474,13 +452,6 @@ namespace {
474
452
}
475
453
}
476
454
477
- // / Mark the block as a failure path, indicating the self value has been
478
- // / consumed.
479
- void markFailure (bool partial) {
480
- LocalSelfConsumed = (partial ? DIKind::Partial : DIKind::Yes);
481
- OutSelfConsumed = LocalSelfConsumed;
482
- }
483
-
484
455
// / Mark the block as storing to self, indicating the self box has been
485
456
// / initialized.
486
457
void markStoreToSelf () {
@@ -490,8 +461,7 @@ namespace {
490
461
491
462
// / If true, we're not done with our dataflow analysis yet.
492
463
bool containsUndefinedValues () {
493
- return (!OutSelfConsumed.hasValue () ||
494
- !OutSelfInitialized.hasValue () ||
464
+ return (!OutSelfInitialized.hasValue () ||
495
465
OutAvailability.containsUnknownElements ());
496
466
}
497
467
};
@@ -515,7 +485,6 @@ namespace {
515
485
DIMemoryObjectInfo TheMemory;
516
486
517
487
SmallVectorImpl<DIMemoryUse> &Uses;
518
- TinyPtrVector<TermInst *> &FailableInits;
519
488
TinyPtrVector<SILInstruction *> &StoresToSelf;
520
489
SmallVectorImpl<SILInstruction *> &Destroys;
521
490
std::vector<ConditionalDestroy> ConditionalDestroys;
@@ -566,7 +535,6 @@ namespace {
566
535
int getAnyUninitializedMemberAtInst (SILInstruction *Inst, unsigned FirstElt,
567
536
unsigned NumElts);
568
537
569
- DIKind getSelfConsumedAtInst (SILInstruction *Inst);
570
538
DIKind getSelfInitializedAtInst (SILInstruction *Inst);
571
539
572
540
bool isInitializedAtUse (const DIMemoryUse &Use,
@@ -601,7 +569,6 @@ namespace {
601
569
void putIntoWorkList (SILBasicBlock *BB, WorkListType &WorkList);
602
570
void computePredsLiveOut (SILBasicBlock *BB);
603
571
void getOutAvailability (SILBasicBlock *BB, AvailabilitySet &Result);
604
- void getOutSelfConsumed (SILBasicBlock *BB, Optional<DIKind> &Result);
605
572
void getOutSelfInitialized (SILBasicBlock *BB, Optional<DIKind> &Result);
606
573
607
574
bool shouldEmitError (SILInstruction *Inst);
@@ -620,8 +587,8 @@ namespace {
620
587
LifetimeChecker::LifetimeChecker (const DIMemoryObjectInfo &TheMemory,
621
588
DIElementUseInfo &UseInfo)
622
589
: Module(TheMemory.MemoryInst->getModule ()), TheMemory(TheMemory),
623
- Uses(UseInfo.Uses), FailableInits (UseInfo.FailableInits ),
624
- StoresToSelf(UseInfo.StoresToSelf), Destroys(UseInfo.Releases) {
590
+ Uses(UseInfo.Uses), StoresToSelf (UseInfo.StoresToSelf ),
591
+ Destroys(UseInfo.Releases) {
625
592
626
593
// The first step of processing an element is to collect information about the
627
594
// element into data structures we use later.
@@ -653,16 +620,6 @@ LifetimeChecker::LifetimeChecker(const DIMemoryObjectInfo &TheMemory,
653
620
getBlockInfo (bb).markStoreToSelf ();
654
621
}
655
622
656
- // Mark blocks where the self value has been consumed.
657
- for (auto *I : FailableInits) {
658
- auto *bb = I->getSuccessors ()[1 ].getBB ();
659
-
660
- // Horrible hack. Failing inits create critical edges, where all
661
- // 'return nil's end up. We'll split the edge later.
662
- bool criticalEdge = isCriticalEdge (I, 1 );
663
- getBlockInfo (bb).markFailure (criticalEdge);
664
- }
665
-
666
623
// If isn't really a use, but we account for the alloc_box/mark_uninitialized
667
624
// as a use so we see it in our dataflow walks.
668
625
NonLoadUses[TheMemory.MemoryInst ] = ~0U ;
@@ -2535,14 +2492,6 @@ getOutAvailability(SILBasicBlock *BB, AvailabilitySet &Result) {
2535
2492
DEBUG (llvm::dbgs () << " Result: " << Result << " \n " );
2536
2493
}
2537
2494
2538
- void LifetimeChecker::
2539
- getOutSelfConsumed (SILBasicBlock *BB, Optional<DIKind> &Result) {
2540
- computePredsLiveOut (BB);
2541
-
2542
- for (auto *Pred : BB->getPredecessorBlocks ())
2543
- Result = mergeKinds (Result, getBlockInfo (Pred).OutSelfConsumed );
2544
- }
2545
-
2546
2495
void LifetimeChecker::
2547
2496
getOutSelfInitialized (SILBasicBlock *BB, Optional<DIKind> &Result) {
2548
2497
computePredsLiveOut (BB);
@@ -2685,32 +2634,6 @@ int LifetimeChecker::getAnyUninitializedMemberAtInst(SILInstruction *Inst,
2685
2634
return -1 ;
2686
2635
}
2687
2636
2688
- // / getSelfConsumedAtInst - Compute the liveness state for any number of tuple
2689
- // / elements at the specified instruction. The elements are returned as an
2690
- // / AvailabilitySet. Elements outside of the range specified may not be
2691
- // / computed correctly.
2692
- DIKind LifetimeChecker::
2693
- getSelfConsumedAtInst (SILInstruction *Inst) {
2694
- DEBUG (llvm::dbgs () << " Get self consumed at " << *Inst);
2695
-
2696
- SILBasicBlock *InstBB = Inst->getParent ();
2697
- auto &BlockInfo = getBlockInfo (InstBB);
2698
-
2699
- if (BlockInfo.LocalSelfConsumed .hasValue ())
2700
- return *BlockInfo.LocalSelfConsumed ;
2701
-
2702
- Optional<DIKind> Result;
2703
- getOutSelfConsumed (InstBB, Result);
2704
-
2705
- // If the result wasn't computed, we must be analyzing code within
2706
- // an unreachable cycle that is not dominated by "TheMemory". Just force
2707
- // the result to unconsumed so that clients don't have to handle this.
2708
- if (!Result.hasValue ())
2709
- Result = DIKind::No;
2710
-
2711
- return *Result;
2712
- }
2713
-
2714
2637
// / getSelfInitializedAtInst - Check if the self box in an initializer has
2715
2638
// / a fully initialized value at the specified instruction.
2716
2639
// /
0 commit comments