[llvm] [NFC][LoopVectorize] Make replaceVPBBWithIRVPBB more efficient (PR #111514)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 10 14:06:54 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);
----------------
fhahn wrote:
Might be good to also go ahead and adjust this code to work for any number of predecessor by iterating over them and replacing the successor?
Appending the predecessors to IRVPBB should be fine, as they should be empty to start with
https://github.com/llvm/llvm-project/pull/111514
More information about the llvm-commits
mailing list