[PATCH] D94870: [InstSimplify] Handle commutativity for 'and' and 'outer or' for (~A & B) | ~(A | B) --> ~A

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Jan 16 09:47:01 PST 2021


lebedev.ri added a comment.

Please precommit tests.
This is more like it.



================
Comment at: llvm/lib/Analysis/InstructionSimplify.cpp:2272
       match(Op1, m_Not(m_c_Or(m_Specific(A), m_Specific(B)))))
-    return cast<BinaryOperator>(Op0)->getOperand(0);
+    return cast<BinaryOperator>(Op0)->getOperand(0) == B
+               ? cast<BinaryOperator>(Op0)->getOperand(1)
----------------
Just capture it when patternmatching?


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

https://reviews.llvm.org/D94870



More information about the llvm-commits mailing list