[llvm] [NFC][LoopVectorize] Make replaceVPBBWithIRVPBB more efficient (PR #111514)

David Sherwood via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 11 01:55:07 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});
----------------
david-arm wrote:

Good suggestion - I've added a new VPBlockUtils::reassociateBlock function and do the replacements in there!

https://github.com/llvm/llvm-project/pull/111514


More information about the llvm-commits mailing list