[llvm] [VPlan] Simplify (x && y) || (x && z) -> x && (y || z) (PR #156308)
Luke Lau via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 1 04:57:55 PDT 2025
================
@@ -1092,6 +1092,17 @@ static void simplifyRecipe(VPRecipeBase &R, VPTypeAnalysis &TypeInfo) {
return;
}
+ // (x && y) || (x && z) -> x && (y || z)
+ VPBuilder Builder(Def);
+ if (match(Def, m_c_BinaryOr(m_LogicalAnd(m_VPValue(X), m_VPValue(Y)),
+ m_LogicalAnd(m_Deferred(X), m_VPValue(Z)))) &&
----------------
lukel97 wrote:
I also initially wrote this but it turns out m_c_LogicalAnd doesn't yet exist for VPlanPatternMatch 🥲
Probably a good separate PR to add it and go through all uses of m_LogicalAnd and see what can be made commutative?
https://github.com/llvm/llvm-project/pull/156308
More information about the llvm-commits
mailing list