@@ -453,12 +453,10 @@ static bool computeLiveness(CopyPropagationState &pass) {
453453// / (assuming no critical edges).
454454static void insertDestroyOnCFGEdge (SILBasicBlock *predBB, SILBasicBlock *succBB,
455455 CopyPropagationState &pass) {
456- // FIXME: ban critical edges and avoid invalidating CFG analyses.
457- auto *destroyBB = splitIfCriticalEdge (predBB, succBB);
458- if (destroyBB != succBB)
459- pass.markInvalid (SILAnalysis::InvalidationKind::Branches);
456+ assert (succBB->getSinglePredecessorBlock () == predBB &&
457+ " value is live-out on another predBB successor: critical edge?" );
460458
461- SILBuilderWithScope builder (destroyBB ->begin ());
459+ SILBuilderWithScope builder (succBB ->begin ());
462460 auto *di =
463461 builder.createDestroyValue (succBB->begin ()->getLoc (), pass.currDef );
464462
@@ -543,13 +541,8 @@ static void findOrInsertDestroys(CopyPropagationState &pass) {
543541 auto visitBB = [&](SILBasicBlock *bb, SILBasicBlock *succBB) {
544542 switch (pass.liveness .isBlockLive (bb)) {
545543 case LiveOut:
546- // If succBB is null, then the original destroy must be an inner
547- // nested destroy, so just skip it.
548- //
549- // Otherwise, this CFG edge is a liveness boundary, so insert a new
550- // destroy on the edge.
551- if (succBB)
552- insertDestroyOnCFGEdge (bb, succBB, pass);
544+ assert (succBB && " value live-out of a block where it is consumed" );
545+ insertDestroyOnCFGEdge (bb, succBB, pass);
553546 break ;
554547 case LiveWithin:
555548 // The liveness boundary is inside this block. Insert a final destroy
0 commit comments