[llvm] [VPlan] Simplify the computation of the block entry mask. (PR #173265)

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 11 00:29:49 PST 2026


================
@@ -127,15 +133,33 @@ VPValue *VPPredicator::createEdgeMask(VPBasicBlock *Src, VPBasicBlock *Dst) {
 }
 
 void VPPredicator::createBlockInMask(VPBasicBlock *VPBB) {
-  // Start inserting after the block's phis, which be replaced by blends later.
+  // Compute the edge masks for all incoming edges to VPBB. Insert after the
+  // block's phis, which will be replaced by blends later.
+  // TODO: Skip creating edge masks for blocks that are control-flow equivalent
+  // to header and have no phis.
   Builder.setInsertPoint(VPBB, VPBB->getFirstNonPhi());
+  for (auto *Predecessor : SetVector<VPBlockBase *>(
----------------
lukel97 wrote:

Nit, can we compute the predecessors SetVector once and share it with line 160?


```suggestion
  SetVector<VPBlockBase *> Predecessors(VPBB->predecessors().begin(), VPBB->predecessors().end());
  for (auto *Predecessor : Predecessors) {
```

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


More information about the llvm-commits mailing list