[llvm] [NFC][LoopVectorize] Make replaceVPBBWithIRVPBB more efficient (PR #111514)
Paul Walker via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 10 05:18:11 PDT 2024
================
@@ -1005,12 +1005,14 @@ static void replaceVPBBWithIRVPBB(VPBasicBlock *VPBB, BasicBlock *IRBB) {
R.moveBefore(*IRVPBB, IRVPBB->end());
}
VPBlockBase *PredVPBB = VPBB->getSinglePredecessor();
- VPBlockUtils::disconnectBlocks(PredVPBB, VPBB);
- VPBlockUtils::connectBlocks(PredVPBB, IRVPBB);
- for (auto *Succ : to_vector(VPBB->getSuccessors())) {
- VPBlockUtils::connectBlocks(IRVPBB, Succ);
- VPBlockUtils::disconnectBlocks(VPBB, Succ);
- }
+ PredVPBB->replaceSuccessor(VPBB, IRVPBB);
+ IRVPBB->setPredecessors({PredVPBB});
+ for (auto *Succ : to_vector(VPBB->getSuccessors()))
+ Succ->replacePredecessor(VPBB, IRVPBB);
+ IRVPBB->setSuccessors(VPBB->getSuccessors());
+
+ VPBB->clearSuccessors();
+ VPBB->clearPredecessors();
----------------
paulwalker-arm wrote:
Are these necessary? I'd expect `delete VPBB` to be sufficient to clean up the SmallVectors?
https://github.com/llvm/llvm-project/pull/111514
More information about the llvm-commits
mailing list