[llvm] [VPlan] Manage created blocks directly in VPlan. (NFC) (PR #120918)

via llvm-commits llvm-commits at lists.llvm.org
Sun Dec 29 14:26:14 PST 2024


================
@@ -822,32 +814,33 @@ void VPRegionBlock::print(raw_ostream &O, const Twine &Indent,
 #endif
 
 VPlan::VPlan(Loop *L) {
-  setEntry(VPIRBasicBlock::fromBasicBlock(L->getLoopPreheader()));
-  ScalarHeader = VPIRBasicBlock::fromBasicBlock(L->getHeader());
+  setEntry(createVPIRBasicBlock(L->getLoopPreheader()));
+  ScalarHeader = createVPIRBasicBlock(L->getHeader());
 }
 
 VPlan::~VPlan() {
-  if (Entry) {
     VPValue DummyValue;
-    for (VPBlockBase *Block : vp_depth_first_shallow(Entry))
-      Block->dropAllReferences(&DummyValue);
 
-    VPBlockBase::deleteCFG(Entry);
-  }
+    for (auto *VPB : CreatedBlocks) {
+      if (auto *VPBB = dyn_cast<VPBasicBlock>(VPB)) {
+        // Replace all operands of recipes and all VPValues define in VPBB with
----------------
ayalz wrote:

```suggestion
        // Replace all operands of recipes and all VPValues defined in VPBB with
```

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


More information about the llvm-commits mailing list