[PATCH] D86363: InstCombine transform pattern "(A ^ B) | ~(A | B) -> ~(A & B)" added
Roman Lebedev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 21 12:50:45 PDT 2020
lebedev.ri added reviewers: spatel, lebedev.ri.
lebedev.ri added inline comments.
================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp:2698-2699
+ // (A ^ B) | ~(A | B) -> ~(A & B)
+ if (match(Op0, m_Xor(m_Value(A), m_Value(B))))
+ if (match(Op1, m_Not(m_Or(m_Value(A), m_Value(B)))))
+ return BinaryOperator::CreateNot(Builder.CreateAnd(A, B));
----------------
Indeed, this doesn't ensure that it's the same A/B each time, so it's a miscompile
This should be
```
if(match(&I, m_c_Or(m_Xor(m_Value(A), m_Value(B)), m_Not(m_c_Or(m_Deferred(A), m_Deferred(B))))))
```
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D86363/new/
https://reviews.llvm.org/D86363
More information about the llvm-commits
mailing list