[PATCH] D61307: [InstCombine] Add new combine to sub folding

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 30 06:46:59 PDT 2019


lebedev.ri added a comment.

Were there tests with extra uses? If not, do add.



================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp:1535-1536
+  // (Y | X) - Y --> (Y | X) ^ Y
+  if (match(Op0, m_OneUse(m_c_Or(m_Value(X), m_Specific(Op1)))))
+    return BinaryOperator::CreateXor(Builder.CreateOr(X, Op1), Op1);
+
----------------
I do not understand. You don't change the inner pattern at all.
Just do:
```
  if (match(Op0, m_c_Or(m_Specific(Op1), m_Value())))
    return BinaryOperator::CreateXor(Op0, Op1);
```


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

https://reviews.llvm.org/D61307





More information about the llvm-commits mailing list