[llvm] [VPlan] Replace VPRegionBlock with explicit CFG before execute (NFCI). (PR #117506)

via llvm-commits llvm-commits at lists.llvm.org
Tue May 13 14:38:32 PDT 2025


================
@@ -207,6 +207,19 @@ VPBlockBase *VPBlockBase::getEnclosingBlockWithPredecessors() {
   return Parent->getEnclosingBlockWithPredecessors();
 }
 
+bool VPBlockUtils::isHeader(const VPBlockBase *VPB,
+                            const VPDominatorTree &VPDT) {
+  auto *VPBB = dyn_cast<VPBasicBlock>(VPB);
+  if (!VPBB)
+    return false;
+  if (auto *R = VPBB->getParent())
+    return !R->isReplicator() && VPBB->getNumPredecessors() == 0;
+
+  assert(!VPB->getParent() && "checking blocks in regions not implemented yet");
+  return VPB->getPredecessors().size() == 2 &&
----------------
ayalz wrote:


```suggestion
  // A header dominates its second predecessor (the latch), with the other predecessor being the preheader.
  return VPB->getPredecessors().size() == 2 &&
```


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


More information about the llvm-commits mailing list