[PATCH] D113861: [InstSimplify] Fold A|B | (A^B) --> A|B

Stanislav Mekhanoshin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 15 08:43:02 PST 2021


rampitec added inline comments.


================
Comment at: llvm/lib/Analysis/InstructionSimplify.cpp:2270
+  // (B | A) | (A ^ B) --> B | A
+  if (match(Op1, m_c_Xor(m_Value(A), m_Value(B))) &&
+      match(Op0, m_c_Or(m_Specific(A), m_Specific(B))))
----------------
There is no need to use commuted matcher for the first pattern, it will match anyway.


================
Comment at: llvm/lib/Analysis/InstructionSimplify.cpp:2277
+  // (A ^ B) | (B | A) --> B | A
+  if (match(Op0, m_c_Xor(m_Value(A), m_Value(B))) &&
+      match(Op1, m_c_Or(m_Specific(A), m_Specific(B))))
----------------
Same here, you can use just m_Xor.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D113861



More information about the llvm-commits mailing list