[PATCH] D137435: [InstSimplify] (~A & B) | ~(A | B) --> ~A with logical and

Dave Green via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 4 09:23:18 PDT 2022


dmgreen added inline comments.


================
Comment at: llvm/lib/Analysis/InstructionSimplify.cpp:2266
+  // The same is true of Logical And
+  if (match(X, m_c_LogicalAnd(
+                   m_CombineAnd(m_Value(NotA), m_NotForbidUndef(m_Value(A))),
----------------
nikic wrote:
> m_c_LogicalAnd also matches m_c_And, no need for both.
Yeah I had that originally, but according to the tests m_c_LogicalAnd only matches i1 types and the original pattern works for an Or of any size.


================
Comment at: llvm/lib/Analysis/InstructionSimplify.cpp:2269
+                   m_Value(B))) &&
+      match(Y, m_Not(m_c_Or(m_Specific(A), m_Specific(B)))))
+    return NotA;
----------------
nikic wrote:
> From a quick try, it looks like this can also be LogicalOr?
Sounds good to me.


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

https://reviews.llvm.org/D137435



More information about the llvm-commits mailing list