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

via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 10 06:33:48 PDT 2026


================
@@ -130,6 +136,15 @@ VPValue *VPPredicator::createEdgeMask(const VPBasicBlock *Src,
 void VPPredicator::createBlockInMask(VPBasicBlock *VPBB) {
   // Start inserting after the block's phis, which be replaced by blends later.
   Builder.setInsertPoint(VPBB, VPBB->getFirstNonPhi());
+
+  // Reuse the mask of the header if the VPBB post-dominates the header.
+  // TODO: Generalize to reuse mask of immediate dominator.
+  VPBasicBlock *Header =
----------------
ayalz wrote:

> We're going to replace that with immediate dominator in the next PR, so I'm not sure if it's worth the effort.

Post-approval comment for next PR: this optimization applies to any dominator of VPBB which VPBB post-dominates, not restricted to header nor to immediate dominator.

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


More information about the llvm-commits mailing list