@@ -870,6 +870,7 @@ void EscapeAnalysis::ConnectionGraph::computeUsePoints() {
870870#include " swift/AST/ReferenceStorage.def"
871871 case SILInstructionKind::StrongReleaseInst:
872872 case SILInstructionKind::ReleaseValueInst:
873+ case SILInstructionKind::DestroyValueInst:
873874 case SILInstructionKind::ApplyInst:
874875 case SILInstructionKind::TryApplyInst: {
875876 // / Actually we only add instructions which may release a reference.
@@ -2589,8 +2590,9 @@ bool EscapeAnalysis::canEscapeToUsePoint(SILValue value,
25892590 SILInstruction *usePoint,
25902591 ConnectionGraph *conGraph) {
25912592
2592- assert ((FullApplySite::isa (usePoint) || isa<RefCountingInst>(usePoint))
2593- && " use points are only created for calls and refcount instructions" );
2593+ assert ((FullApplySite::isa (usePoint) || isa<RefCountingInst>(usePoint) ||
2594+ isa<DestroyValueInst>(usePoint)) &&
2595+ " use points are only created for calls and refcount instructions" );
25942596
25952597 CGNode *node = conGraph->getValueContent (value);
25962598 if (!node)
@@ -2649,6 +2651,14 @@ bool EscapeAnalysis::canEscapeTo(SILValue V, RefCountingInst *RI) {
26492651 return canEscapeToUsePoint (V, RI, ConGraph);
26502652}
26512653
2654+ bool EscapeAnalysis::canEscapeTo (SILValue V, DestroyValueInst *DVI) {
2655+ // If it's not uniquely identified we don't know anything about the value.
2656+ if (!isUniquelyIdentified (V))
2657+ return true ;
2658+ auto *ConGraph = getConnectionGraph (DVI->getFunction ());
2659+ return canEscapeToUsePoint (V, DVI, ConGraph);
2660+ }
2661+
26522662// / Utility to get the function which contains both values \p V1 and \p V2.
26532663static SILFunction *getCommonFunction (SILValue V1, SILValue V2) {
26542664 SILBasicBlock *BB1 = V1->getParentBlock ();
0 commit comments