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

via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 25 08:53:07 PDT 2024


================
@@ -3862,6 +3882,19 @@ class VPBlockUtils {
     To->removePredecessor(From);
   }
 
+  /// Reassociate all the blocks connected to \p Old so that they now point to
+  /// \p New.
+  static void reassociateBlocks(VPBlockBase *Old, VPBlockBase *New) {
+    for (auto *Pred : to_vector(Old->getPredecessors()))
+      Pred->replaceSuccessor(Old, New);
+    for (auto *Succ : to_vector(Old->getSuccessors()))
----------------
ayalz wrote:

Is this to_vector() needed, given that Old's successors remain intact?

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


More information about the llvm-commits mailing list