[llvm] [LV] Add vplan folds for (X - (X & Y)) -> (X & ~Y) (PR #226466)

Paul Walker via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 25 05:26:10 PDT 2026


================
@@ -1528,6 +1528,15 @@ static VPSingleDefRecipe *combineRecipe(VPlan &Plan, VPSingleDefRecipe *Def,
   }
 
   const APInt *APC;
+
+  // (X - (X & Y)) -> (X & ~Y)
+  if (CanCreateNewRecipe &&
+      match(Def,
+            m_Sub(m_VPValue(X), m_c_BinaryAnd(m_Deferred(X), m_VPValue(Y)))) &&
+      match(Y, m_APInt(APC)))
----------------
paulwalker-arm wrote:

Can the two matchers be combined? because Y is not used in the result.

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


More information about the llvm-commits mailing list