[llvm] [VPlan] Reuse mask of immediate dominator in VPlanPredicator (PR #185595)

Mel Chen via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 13 03:18:39 PDT 2026


================
@@ -126,6 +135,16 @@ 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 immediate dominator if the VPBB post-dominates the
+  // immediate dominator.
+  auto *IDom = VPDT.getNode(VPBB)->getIDom();
----------------
Mel-Chen wrote:

I feel this check might not be necessary, as the situation may not occur. Suppose A immediately dominates B, and B immediately dominates C. If we already know that C does not post-dominate B, then C cannot post-dominate A either.

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


More information about the llvm-commits mailing list