[PATCH] D115755: [InstSimplify] Fold logic And to Zero

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 21 05:49:36 PST 2021


spatel added a comment.

The code seems more complicated than necessary (and the tests less thorough than necessary). 
We know that the 'or' instruction is a shared op, so let's match that first and then match it again as a specific value? 
If I'm seeing it correctly, that means there are 8 potential commutes:

  BinaryOperator *Or;
  if (match(Op0, m_c_Xor(m_Value(X), m_BinOp(Or))))
    if (match(Or, m_c_Or(m_Specific(X), m_Value(Y))) &&
        match(Op1, m_c_Xor(m_Specific(Or), m_Specific(Y))))
      return Constant::getNullValue(Op0->getType());


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D115755



More information about the llvm-commits mailing list