[PATCH] D122077: [InstCombine] Fold (ctpop(X) == 1) | (X == 0) into ctpop(X) < 2

Craig Topper via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Mar 20 15:29:06 PDT 2022


craig.topper added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp:921
+  if (IsAnd &&
+      match(Cmp0, m_ICmp(Pred0, m_Intrinsic<Intrinsic::ctpop>(m_Value(X)),
+                         m_SpecificInt(1))) &&
----------------
Since the m_ICmp matches are the same for And/Or can we share those and possibly early out from the function if they don't match. Then only use `IsAnd` to check the predicates and control the what we emit?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D122077



More information about the cfe-commits mailing list