[PATCH] D101210: [InstCombine] ctpop(X) + ctpop(Y) => ctpop(X | Y) if X and Y have no common bits (PR48999)

Dávid Bolvanský via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Apr 24 08:11:00 PDT 2021


xbolva00 added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp:1453
+  if (match(&I,
+            m_c_BinOp(m_OneUse(m_Intrinsic<Intrinsic::ctpop>(m_Value(A))),
+                      m_OneUse(m_Intrinsic<Intrinsic::ctpop>(m_Value(B))))) &&
----------------
nikic wrote:
> As the pattern on both sides is the same, you don't need to use m_c_BinOp, you can just directly match LHS and RHS against ctpop.
I am bit confused now. Not same?
I can match lhs and rhs but then I need 2x mode code to handle ctpop(B) + ctpop(A) too.


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

https://reviews.llvm.org/D101210



More information about the llvm-commits mailing list