[llvm] [VPlan] Remove (X && Y) | (X && !Y) -> X combine. NFC (PR #219368)

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 28 05:09:03 PDT 2026


================
@@ -1171,13 +1171,7 @@ static void removeRedundantExpandSCEVRecipes(VPlan &Plan) {
 
 /// Try to simplify logical and bitwise recipes in \p Def.
 static VPValue *simplifyLogicalRecipe(VPlan &Plan, VPSingleDefRecipe *Def) {
-  // Simplify (X && Y) | (X && !Y) -> X.
-  // TODO: Remove now that we have smaller combines for this.
-  VPValue *X, *Y;
----------------
lukel97 wrote:

I couldn't find any instances of this IR making its way into VPlan since InstCombine already simplifies this: https://godbolt.org/z/vPYM84PP4

And from what I can tell VPlanPredicator won't generate a mask in this format either.

It looks like it's possible to handle the multi-use case by relaxing the single-user restriction on the `(X && Y) | (X && Z) -> X && (Y | Z)` combine when `y | z` will simplify, but I'm wondering if it's worth it since it won't be used in any end-to-end pipeline.

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


More information about the llvm-commits mailing list