Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 0 additions & 46 deletions lib/SILOptimizer/Mandatory/DefiniteInitialization.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -474,9 +474,6 @@ namespace {

AvailabilitySet getLivenessAtInst(SILInstruction *Inst, unsigned FirstElt,
unsigned NumElts);
AvailabilitySet getLivenessAtNonTupleInst(SILInstruction *Inst,
SILBasicBlock *InstBB,
AvailabilitySet &CurrentSet);
int getAnyUninitializedMemberAtInst(SILInstruction *Inst, unsigned FirstElt,
unsigned NumElts);

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

AvailabilitySet
LifetimeChecker::getLivenessAtNonTupleInst(swift::SILInstruction *Inst,
swift::SILBasicBlock *InstBB,
AvailabilitySet &Result) {
// If there is a store in the current block, scan the block to see if the
// store is before or after the load. If it is before, it produces the value
// we are looking for.
if (getBlockInfo(InstBB).HasNonLoadUse) {
for (auto BBI = Inst->getIterator(), E = InstBB->begin(); BBI != E;) {
--BBI;
SILInstruction *TheInst = &*BBI;

if (TheInst == TheMemory.getUninitializedValue()) {
Result.set(0, DIKind::No);
return Result;
}

if (NonLoadUses.count(TheInst)) {
// We've found a definition, or something else that will require that
// the memory is initialized at this point.
Result.set(0, DIKind::Yes);
return Result;
}
}
}

getOutAvailability(InstBB, Result);

// If the result element wasn't computed, we must be analyzing code within
// an unreachable cycle that is not dominated by "TheMemory". Just force
// the unset element to yes so that clients don't have to handle this.
if (!Result.getConditional(0))
Result.set(0, DIKind::Yes);

return Result;
}

/// getLivenessAtInst - Compute the liveness state for any number of tuple
/// elements at the specified instruction. The elements are returned as an
/// AvailabilitySet. Elements outside of the range specified may not be
Expand All @@ -3648,12 +3608,6 @@ AvailabilitySet LifetimeChecker::getLivenessAtInst(SILInstruction *Inst,

SILBasicBlock *InstBB = Inst->getParent();

// The vastly most common case is memory allocations that are not tuples,
// so special case this with a more efficient algorithm.
if (TheMemory.getNumElements() == 1) {
return getLivenessAtNonTupleInst(Inst, InstBB, Result);
}

// Check locally to see if any elements are satisfied within the block, and
// keep track of which ones are still needed in the NeededElements set.
SmallBitVector NeededElements(TheMemory.getNumElements());
Expand Down