[llvm] [LV] Add vplan folds for (X - (X & Y)) -> (X & ~Y) (PR #226466)
David Sherwood via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 25 05:29:00 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)))
----------------
david-arm wrote:
Oh yeah you're right. I think this is because I was originally trying to also add support for non-constant folds too, but then limited it to purely constants.
https://github.com/llvm/llvm-project/pull/226466
More information about the llvm-commits
mailing list