[llvm] [VPlan] Reassociate header masks (PR #155383)
Ramkumar Ramachandra via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 1 08:47:16 PDT 2025
================
@@ -1119,6 +1120,14 @@ static void simplifyRecipe(VPRecipeBase &R, VPTypeAnalysis &TypeInfo) {
return;
}
+ // Reassociate the header mask so it has more opportunities to be simplified.
+ // (headermask && x) && y -> headermask && (x && y)
+ if (HeaderMask && match(Def, m_LogicalAnd(m_LogicalAnd(m_Specific(HeaderMask),
+ m_VPValue(X)),
+ m_VPValue(Y))))
+ return Def->replaceAllUsesWith(
+ Builder.createLogicalAnd(HeaderMask, Builder.createLogicalAnd(X, Y)));
+
----------------
artagnon wrote:
Hm, not sure if we can generalize this to reassociate in a more general case: not sure why header masks are special?
https://github.com/llvm/llvm-project/pull/155383
More information about the llvm-commits
mailing list