[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:48 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 *>(
+ VPBB->getPredecessors().begin(), VPBB->getPredecessors().end()))
+ createEdgeMask(cast<VPBasicBlock>(Predecessor), VPBB);
+
+ // Reuse the mask of header block if VPBB is control-flow equivalent to
----------------
lukel97 wrote:
```suggestion
// Reuse the mask of the header if VPBB is post-dominated by it
```
https://github.com/llvm/llvm-project/pull/173265
More information about the llvm-commits
mailing list