[PATCH] D154306: [InstCombine] Generalise ((x1 ^ y1) | (x2 ^ y2)) == 0 transform to more than two pairs of variables

Maksim Kita via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 2 11:36:42 PDT 2023


kitaisreal marked 2 inline comments as done.
kitaisreal added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp:2060
+
+    auto *BO = dyn_cast<BinaryOperator>(OrOp0);
+    if (BO && BO->getOpcode() == BinaryOperator::Or) {
----------------
goldstein.w.n wrote:
> goldstein.w.n wrote:
> > Shouldn't we also be able to chase OrOp1 (if it doesn't match `Xor`).
> > 
> > Figure it should be something along the lines of:
> > ```
> > if(match(Op0, Xor) && match(Op1, Xor)) {
> >  // Base Case
> > }
> > else if(match(Op0, Xor)) {
> >  // Chase Op1
> > }
> > else if(match(Op1, Xor)) {
> >  // Chase Op1
> > }
> > else {
> >  break;
> > }
> > ```
> Err third condition should be "Chase Op0"
Agree. Updated.


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

https://reviews.llvm.org/D154306



More information about the llvm-commits mailing list