[llvm] [VPlan] Simplify (X && Y) || (X && !Y) -> X. (PR #89386)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 25 14:01:09 PDT 2024


================
@@ -192,6 +191,47 @@ using AllBinaryRecipe_match =
     BinaryRecipe_match<Op0_t, Op1_t, Opcode, VPWidenRecipe, VPReplicateRecipe,
                        VPWidenCastRecipe, VPInstruction>;
 
+template <typename Op0_t, typename Op1_t, unsigned Opcode, bool Commutable,
+          typename... RecipeTys>
+struct LogicalRecipe_match {
+  Op0_t LHS;
+  Op1_t RHS;
+
+  LogicalRecipe_match(Op0_t LHS, Op1_t RHS) : LHS(LHS), RHS(RHS) {}
+
+  bool match(const VPValue *V) {
+    auto *DefR = V->getDefiningRecipe();
+    return DefR && match(DefR);
+  }
+
+  bool match(const VPSingleDefRecipe *R) {
+    return match(static_cast<const VPRecipeBase *>(R));
----------------
fhahn wrote:

Removed, thanks!

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


More information about the llvm-commits mailing list