[llvm] [VPlan] Simplify vp.merge true, (or x, y), x -> vp.merge y, true, x (PR #135017)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 11 06:25:42 PDT 2025


================
@@ -136,11 +136,32 @@ template <typename LTy, typename RTy> struct match_combine_or {
   }
 };
 
+template <typename LTy, typename RTy> struct match_combine_and {
+  LTy L;
+  RTy R;
+
+  match_combine_and(const LTy &Left, const RTy &Right) : L(Left), R(Right) {}
+
+  template <typename ITy> bool match(ITy *V) const {
+    if (L.match(V))
+      if (R.match(V))
+        return true;
+    return false;
----------------
fhahn wrote:

Can this just be 
```suggestion
    return L.match(V) && R.match(V);
```
?

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


More information about the llvm-commits mailing list