Skip to content

Commit d1b45da

Browse files
committed
Ensure reassociateBlocks leaves Old and New in a decent state
* Since reassociateBlocks is a public interface we should leave the Old and New blocks in a usable state.
1 parent 3da4e4e commit d1b45da

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

llvm/lib/Transforms/Vectorize/VPlan.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1006,10 +1006,7 @@ static void replaceVPBBWithIRVPBB(VPBasicBlock *VPBB, BasicBlock *IRBB) {
10061006
}
10071007

10081008
VPBlockUtils::reassociateBlocks(VPBB, IRVPBB);
1009-
IRVPBB->setPredecessors(VPBB->getPredecessors());
1010-
IRVPBB->setSuccessors(VPBB->getSuccessors());
10111009

1012-
// Any successor/predecessor lists will be cleared on deletion.
10131010
delete VPBB;
10141011
}
10151012

llvm/lib/Transforms/Vectorize/VPlan.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3889,6 +3889,10 @@ class VPBlockUtils {
38893889
Pred->replaceSuccessor(Old, New);
38903890
for (auto *Succ : to_vector(Old->getSuccessors()))
38913891
Succ->replacePredecessor(Old, New);
3892+
New->setPredecessors(Old->getPredecessors());
3893+
New->setSuccessors(Old->getSuccessors());
3894+
Old->clearPredecessors();
3895+
Old->clearSuccessors();
38923896
}
38933897

38943898
/// Return an iterator range over \p Range which only includes \p BlockTy

0 commit comments

Comments
 (0)