@@ -453,12 +453,10 @@ static bool computeLiveness(CopyPropagationState &pass) {
453
453
// / (assuming no critical edges).
454
454
static void insertDestroyOnCFGEdge (SILBasicBlock *predBB, SILBasicBlock *succBB,
455
455
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?" );
460
458
461
- SILBuilderWithScope builder (destroyBB ->begin ());
459
+ SILBuilderWithScope builder (succBB ->begin ());
462
460
auto *di =
463
461
builder.createDestroyValue (succBB->begin ()->getLoc (), pass.currDef );
464
462
@@ -543,13 +541,8 @@ static void findOrInsertDestroys(CopyPropagationState &pass) {
543
541
auto visitBB = [&](SILBasicBlock *bb, SILBasicBlock *succBB) {
544
542
switch (pass.liveness .isBlockLive (bb)) {
545
543
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);
553
546
break ;
554
547
case LiveWithin:
555
548
// The liveness boundary is inside this block. Insert a final destroy
0 commit comments