mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
SIL: Make drop_deinit a ForwardingInstruction.
drop_deinit forwards ownership while effectively stripping the deinitializer. It is similar to a type cast. Fixes rdar://125590074 ([NonescapableTypes] Nonescapable types cannot have deinits)
This commit is contained in:
@@ -547,10 +547,13 @@ static SILBasicBlock::iterator
|
||||
eliminateUnneededForwardingUnarySingleValueInst(SingleValueInstruction *inst,
|
||||
CanonicalizeInstruction &pass) {
|
||||
auto next = std::next(inst->getIterator());
|
||||
|
||||
for (auto *use : getNonDebugUses(inst))
|
||||
if (!isa<DestroyValueInst>(use->getUser()))
|
||||
return next;
|
||||
for (auto *use : getNonDebugUses(inst)) {
|
||||
if (auto *destroy = dyn_cast<DestroyValueInst>(use->getUser())) {
|
||||
if (destroy->isFullDeinitialization())
|
||||
continue;
|
||||
}
|
||||
return next;
|
||||
}
|
||||
deleteAllDebugUses(inst, pass.callbacks);
|
||||
SILValue op = inst->getOperand(0);
|
||||
inst->replaceAllUsesWith(op);
|
||||
|
||||
Reference in New Issue
Block a user