Skip to content

Commit 7ce79f2

Browse files
authored
Merge pull request #85430 from jamieQ/remove-di-non-tuple-carveout
[NFC][DI]: remove getLivenessAtNonTupleInst method from definite init
2 parents bfb6c82 + c76fad8 commit 7ce79f2

File tree

1 file changed

+0
-46
lines changed

1 file changed

+0
-46
lines changed

lib/SILOptimizer/Mandatory/DefiniteInitialization.cpp

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -474,9 +474,6 @@ namespace {
474474

475475
AvailabilitySet getLivenessAtInst(SILInstruction *Inst, unsigned FirstElt,
476476
unsigned NumElts);
477-
AvailabilitySet getLivenessAtNonTupleInst(SILInstruction *Inst,
478-
SILBasicBlock *InstBB,
479-
AvailabilitySet &CurrentSet);
480477
int getAnyUninitializedMemberAtInst(SILInstruction *Inst, unsigned FirstElt,
481478
unsigned NumElts);
482479

@@ -3592,43 +3589,6 @@ void LifetimeChecker::getOutSelfInitialized(SILBasicBlock *BB,
35923589
Result = mergeKinds(Result, getBlockInfo(Pred).OutSelfInitialized);
35933590
}
35943591

3595-
AvailabilitySet
3596-
LifetimeChecker::getLivenessAtNonTupleInst(swift::SILInstruction *Inst,
3597-
swift::SILBasicBlock *InstBB,
3598-
AvailabilitySet &Result) {
3599-
// If there is a store in the current block, scan the block to see if the
3600-
// store is before or after the load. If it is before, it produces the value
3601-
// we are looking for.
3602-
if (getBlockInfo(InstBB).HasNonLoadUse) {
3603-
for (auto BBI = Inst->getIterator(), E = InstBB->begin(); BBI != E;) {
3604-
--BBI;
3605-
SILInstruction *TheInst = &*BBI;
3606-
3607-
if (TheInst == TheMemory.getUninitializedValue()) {
3608-
Result.set(0, DIKind::No);
3609-
return Result;
3610-
}
3611-
3612-
if (NonLoadUses.count(TheInst)) {
3613-
// We've found a definition, or something else that will require that
3614-
// the memory is initialized at this point.
3615-
Result.set(0, DIKind::Yes);
3616-
return Result;
3617-
}
3618-
}
3619-
}
3620-
3621-
getOutAvailability(InstBB, Result);
3622-
3623-
// If the result element wasn't computed, we must be analyzing code within
3624-
// an unreachable cycle that is not dominated by "TheMemory". Just force
3625-
// the unset element to yes so that clients don't have to handle this.
3626-
if (!Result.getConditional(0))
3627-
Result.set(0, DIKind::Yes);
3628-
3629-
return Result;
3630-
}
3631-
36323592
/// getLivenessAtInst - Compute the liveness state for any number of tuple
36333593
/// elements at the specified instruction. The elements are returned as an
36343594
/// AvailabilitySet. Elements outside of the range specified may not be
@@ -3648,12 +3608,6 @@ AvailabilitySet LifetimeChecker::getLivenessAtInst(SILInstruction *Inst,
36483608

36493609
SILBasicBlock *InstBB = Inst->getParent();
36503610

3651-
// The vastly most common case is memory allocations that are not tuples,
3652-
// so special case this with a more efficient algorithm.
3653-
if (TheMemory.getNumElements() == 1) {
3654-
return getLivenessAtNonTupleInst(Inst, InstBB, Result);
3655-
}
3656-
36573611
// Check locally to see if any elements are satisfied within the block, and
36583612
// keep track of which ones are still needed in the NeededElements set.
36593613
SmallBitVector NeededElements(TheMemory.getNumElements());

0 commit comments

Comments
 (0)