[llvm] [VPlan] Migrate VPBuilder to VPInsertPt fully (NFC) (PR #209764)

Ramkumar Ramachandra via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 30 07:12:38 PDT 2026


================
@@ -117,87 +154,40 @@ class VPBuilder {
 
 public:
   VPlan &getPlan() const {
-    assert(getInsertBlock() && "Insert block must be set");
-    return *getInsertBlock()->getPlan();
+    assert(InsertPt && "Insert block must be set");
+    return *InsertPt.getBlock()->getPlan();
   }
 
   VPBuilder() = default;
-  VPBuilder(VPBasicBlock *InsertBB) { setInsertPoint(InsertBB); }
-  VPBuilder(VPRecipeBase *InsertPt) { setInsertPoint(InsertPt); }
-  VPBuilder(VPBasicBlock *TheBB, VPBasicBlock::iterator IP) {
-    setInsertPoint(TheBB, IP);
-  }
-
-  /// Clear the insertion point: created instructions will not be inserted into
-  /// a block.
-  void clearInsertionPoint() {
-    BB = nullptr;
-    InsertPt = VPBasicBlock::iterator();
-  }
+  VPBuilder(const VPInsertPoint &IP) : InsertPt(IP) {}
----------------
artagnon wrote:

My understanding is that it is always the callee that constructs the type, unless a pre-constructed type is passed -- take the simple example of push_back versus emplace_back; in push_back, the caller either pre-constructs ValueTy, or implicitly calls the container's ValueTy constructor at caller argument-expansion, while in emplace_back, we perfect-forward so the callee delays construction from argument-expansion-time to the actual allocation.

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


More information about the llvm-commits mailing list