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

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 14 14:39:06 PDT 2024


================
@@ -556,6 +556,26 @@ class VPBlockBase {
     return getEnclosingBlockWithPredecessors()->getSinglePredecessor();
   }
 
+  /// This function replaces one predecessor with another, useful when
+  /// trying to replace an old block in the CFG with a new one.
+  void replacePredecessor(VPBlockBase *Old, VPBlockBase *New) {
+    auto I = find(Predecessors, Old);
+    assert(I != Predecessors.end());
+    assert(Old->getParent() == New->getParent() &&
+           "replaced predecessor must have the same parent");
+    *I = New;
----------------
fhahn wrote:

Right, let me take a look tomorrow

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


More information about the llvm-commits mailing list