[PATCH] D126040: [InstCombine] Fold a mul with bool value into and
Allen zhong via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed May 25 06:09:37 PDT 2022
Allen added inline comments.
================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp:382-383
+ // rather than -X & Y, but it's increasing the count either way.)
+ if (match(Op0, m_And(m_Value(X), m_One())) &&
+ match(Op1, m_And(m_Value(Y), m_One())))
+ return BinaryOperator::CreateAnd(Op0, Op1);
----------------
spatel wrote:
> Allen wrote:
> > spatel wrote:
> > > Don't capture X and Y if we are not using them in the new instruction.
> > Thanks @spatel very much, as the m_And operation need 2 operands. How can I not match the 1st operand?
> > Do you mean use the **Op0->gtOpcode() == Instruction::And && isOneConstant(Op0->getOperand(1))** ?
> If you don't need to capture the operand value, then you just leave the argument empty:
> match(Op0, m_And(m_Value(), m_One()))
thanks very much, apply your comment
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D126040/new/
https://reviews.llvm.org/D126040
More information about the llvm-commits
mailing list