[llvm] [VPlan] Migrate VPBuilder to VPInsertPt fully (NFC) (PR #209764)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 30 04:26:47 PDT 2026
================
@@ -117,87 +154,44 @@ 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) {}
+ VPBuilder(VPBasicBlock *TheBB, VPBasicBlock::iterator IP)
+ : InsertPt(TheBB, IP) {}
- VPBasicBlock *getInsertBlock() const { return BB; }
- VPBasicBlock::iterator getInsertPoint() const { return InsertPt; }
+ /// Get the recipe at the current point.
+ VPRecipeBase *getRecipe() const { return InsertPt; }
----------------
fhahn wrote:
Would probably be good to clarify this returns the recipe at the insert point
```suggestion
/// Get the recipe at the current insert point or nullptr if the insert point is the end of the block.
VPRecipeBase *getRecipeAtInsertPoint() const { return InsertPt; }
```
https://github.com/llvm/llvm-project/pull/209764
More information about the llvm-commits
mailing list