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

via llvm-commits llvm-commits at lists.llvm.org
Sun Dec 29 11:54:09 PST 2024


================
@@ -1257,9 +1263,24 @@ VPlan *VPlan::duplicate() {
   assert(Old2NewVPValues.contains(TripCount) &&
          "TripCount must have been added to Old2NewVPValues");
   NewPlan->TripCount = Old2NewVPValues[TripCount];
+
+  // Transfer cloned blocks to new VPlan.
+  for (unsigned I : seq<unsigned>(CreatedBlockSize, CreatedBlocks.size()))
+    NewPlan->CreatedBlocks.push_back(CreatedBlocks[I]);
----------------
ayalz wrote:

```suggestion
  unsigned NumBlocksAfterCloning = CreatedBlocks.size();
  for (unsigned I : seq<unsigned>(NumBlocksBeforeCloning, NumBlocksAfterCloning))
    NewPlan->CreatedBlocks.push_back(this->CreatedBlocks[I]);
```

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


More information about the llvm-commits mailing list