[PATCH] D132658: [InstCombine] Distributive or+mul with const operand
Allen zhong via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 25 21:27:05 PDT 2022
Allen marked 2 inline comments as done.
Allen added inline comments.
================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp:224
// Simplify mul instructions with a constant RHS.
if (isa<Constant>(Op1)) {
// Canonicalize (X+C1)*CI -> X*CI+C1*CI.
----------------
bcl5980 wrote:
> If we update current code, Op1 should be m_ImmConstant also
Done, thanks
================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp:232
+ if ((match(Op0, m_OneUse(m_Add(m_Value(X), m_Constant(C1))))) ||
+ (match(Op0, m_OneUse(m_Or(m_Value(X), m_Constant(C1)))) &&
+ match(C1, m_APInt(C1Val)) &&
----------------
bcl5980 wrote:
> Match 'or' then check haveNoCommonBitsSet should be better I think.
Thanks very much, use haveNoCommonBitsSet make the code much clear.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D132658/new/
https://reviews.llvm.org/D132658
More information about the llvm-commits
mailing list