[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 19:24:14 PDT 2022


Allen added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp:237-240
       Value *Mul = Builder.CreateMul(C1, Op1);
       // Only go forward with the transform if C1*CI simplifies to a tidier
       // constant.
       if (!match(Mul, m_Mul(m_Value(), m_Value())))
----------------
spatel wrote:
> The existing code is awkward. We should update it before adding to it. Use `m_ImmConstant(C1)` to do this transform but ignore a constant expression. 
> 
> I updated the test that was intended to go with this code change here:
> 5260146a8a74084f3d38d8bb448ae3c5690b9084
hi @spatel 
   I tried with your new case, and it will fail on the check **if (!match(Mul, m_Mul(m_Value(), m_Value())))**, so the instcombine will not take active, is it within your expectations?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D132658/new/

https://reviews.llvm.org/D132658



More information about the llvm-commits mailing list