[PATCH] D114339: [InstCombine] simplify (~A | B) ^ A --> ~( A & B)
Sanjay Patel via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 24 11:50:54 PST 2021
spatel added inline comments.
================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp:3657-3658
+ // A ^ (~A | B) --> ~(A & B)
+ if (match(Op1, m_OneUse(m_c_Or(m_Not(m_Value(A)), m_Value(B)))) &&
+ match(Op0, m_Deferred(A)))
+ return BinaryOperator::CreateNot(Builder.CreateAnd(A, B));
----------------
Is this logically different than the m_Specific(Op0) code pattern that I suggested?
Unless I'm missing something, you don't need to use m_Deferred either way. In this code, the clause before `&&` must run and capture 'A' before it is matched as Op0.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D114339/new/
https://reviews.llvm.org/D114339
More information about the llvm-commits
mailing list