[PATCH] D139080: [Instcombine] fold logic ops to select
Sanjay Patel via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 3 11:53:12 PST 2023
spatel added inline comments.
================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp:2973-2974
+ if (match(&I, m_c_BinOp(m_And(m_Value(A), m_Value(C)),
+ m_Not(m_Or(m_Value(B), m_Value(D)))))) {
+ if (Op0->hasOneUse() || Op1->hasOneUse()) {
----------------
This is more general than needed. Complexity canonicalization guarantees that the 'not' is operand 1.
We could also check for the common operand out here for efficiency?
if (match(Op0, m_And(m_Value(A), m_Value(C))) &&
match(Op1, m_Not(m_Or(m_Value(B), m_Value(D)))) &&
hasCommonOperand(A, C, B, D) && (Op0->hasOneUse() || Op1->hasOneUse())) {
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D139080/new/
https://reviews.llvm.org/D139080
More information about the llvm-commits
mailing list