[llvm] [NFC][LoopVectorize] Make replaceVPBBWithIRVPBB more efficient (PR #111514)
David Sherwood via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 14 00:40:19 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;
----------------
david-arm wrote:
For example, `removeSuccessor` does not leave the `Successor` argument in a valid state either because `this` will still be a predecessor of `Successor`. How about I make the functions private and then we can behave like `removeSuccessor`, unless you see value in these new interfaces being public?
https://github.com/llvm/llvm-project/pull/111514
More information about the llvm-commits
mailing list