[llvm] [VPlan] Model initial header mask as region value. (PR #196199)

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 30 03:58:04 PDT 2026


================
@@ -1484,11 +1484,17 @@ static void simplifyRecipe(VPSingleDefRecipe *Def) {
 
   // Drop the mask of a predicated store masked by the header mask (which is
   // guaranteed to be true at least for the first lane) and both the stored
-  // value and the address are uniform across VF and UF.
+  // value and the address are uniform across VF and UF. The header mask is
+  // still the abstract region value here, possibly clamped by an alias mask.
   if (auto *RepR = dyn_cast<VPReplicateRecipe>(Def);
       RepR && RepR->isPredicated() && RepR->getOpcode() == Instruction::Store &&
       all_of(RepR->operandsWithoutMask(), vputils::isUniformAcrossVFsAndUFs) &&
-      vputils::isHeaderMask(RepR->getMask(), *Plan)) {
+      match(RepR->getMask(),
+            m_CombineOr(
+                m_HeaderMask(),
+                m_c_BinaryAnd(
+                    m_HeaderMask(),
+                    m_VPInstruction<VPInstruction::IncomingAliasMask>())))) {
----------------
lukel97 wrote:

Not for this PR, but it would be nice to have a `m_PrefixMask()` matcher for this. I think there's some other places where we want to check for the property that there's at least one active lane, e.g. #172799

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


More information about the llvm-commits mailing list