[PATCH] D114996: Add logic `or` fold

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 3 08:19:31 PST 2021


spatel added inline comments.


================
Comment at: llvm/lib/Analysis/InstructionSimplify.cpp:2231-2232
+  // (A ^ B) | (~B | A) --> -1
+  if (match(X, m_c_Or(m_Not(m_Value(A)), m_Value(B))) &&
+      match(Y, m_c_Xor(m_Specific(A), m_Specific(B))))
+    return ConstantInt::getAllOnesValue(Ty);
----------------
This is more like the folds at lines 2205 / 2213, right? If there are 2 commutative ops, then we are handling 4 distinct patterns.

And that means there should be 8 tests after we account for the swapped operands handled by the caller.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114996



More information about the llvm-commits mailing list