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

via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 3 16:34:20 PST 2024


================
@@ -1266,6 +1293,15 @@ VPlan *VPlan::duplicate() {
   return NewPlan;
 }
 
+VPBasicBlock *VPlan::getScalarPreheader() {
+  auto *MiddleVPBB =
+      cast<VPBasicBlock>(getVectorLoopRegion()->getSingleSuccessor());
+  auto *LastSucc = MiddleVPBB->getSuccessors().back();
+  // Order is strict: if the last successor is VPIRBasicBlock, it must be the
+  // single exit.
----------------
ayalz wrote:

```suggestion
  // If scalar preheader is connected to VPlan, it is the last successor of MiddleVPBB.
  // If this last successor is a VPIRBasicBlock, it is the Exit block rather than the scalar preheader.
```

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


More information about the llvm-commits mailing list