[llvm] [VPlan] Hook IR blocks into VPlan during skeleton creation (NFC) (PR #114292)

via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 4 16:59:23 PST 2024


================
@@ -8054,6 +8059,16 @@ EpilogueVectorizerEpilogueLoop::emitMinimumVectorEpilogueIterCountCheck(
   }
   ReplaceInstWithInst(Insert->getTerminator(), &BI);
   LoopBypassBlocks.push_back(Insert);
+
+  // A new entry block has been created for the epilogue VPlan. Hook it in, as
+  // otherwise we would try to modify the entry to the main vector loop.
+  VPIRBasicBlock *NewEntry = VPIRBasicBlock::fromBasicBlock(Insert);
+  VPBasicBlock *OldEntry = Plan.getEntry();
+  VPBlockUtils::reassociateBlocks(OldEntry, NewEntry);
+  Plan.setEntry(NewEntry);
+  delete OldEntry;
+
+  introduceCheckBlockInVPlan(Plan, nullptr);
----------------
ayalz wrote:

```suggestion
  introduceCheckBlockInVPlan(Plan, Insert);
```
there is a check block to introduction into VPlan, which is fused with its predecessor (could perhaps feed an assert in introduceCheckBlockInVPlan()).

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


More information about the llvm-commits mailing list