[PATCH] D124119: [InstCombine] Combine instructions of type or/and where AND masks can be combined.

Biplob Mishra via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 28 03:23:36 PDT 2022


bipmis marked an inline comment as not done.
bipmis added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp:2970
+    // (C | (D & B)) | (A & B) -> C | ((D & B) | (A & B))
+    if (match(B, m_c_BinOp(Instruction::And, m_Specific(C), m_Value(X))) ||
+        match(B, m_c_BinOp(Instruction::And, m_Specific(D), m_Value(X))))
----------------
bipmis wrote:
> spatel wrote:
> > Why use m_c_BinOp rather than m_c_And?
> > 
> > If we are not using 'X', then there is no reason to capture it - just use plain `m_Value()`.
> m_c_BinOp was used as it can look for 2 operands in either order which is needed and could reduce extra code. 
But yes we could use m_c_And as well. Thanks for pointing this out.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D124119/new/

https://reviews.llvm.org/D124119



More information about the llvm-commits mailing list