[PATCH] D124183: [InstCombine] Add one use limitation for (X * C2) << C1 --> X * (C2 << C1)

chenglin.bi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 21 20:12:32 PDT 2022


bcl5980 added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp:971
     // (C2 << X) << C1 --> (C2 << C1) << X
     if (match(Op0, m_OneUse(m_Shl(m_Constant(C2), m_Value(X)))))
       return BinaryOperator::CreateShl(ConstantExpr::getShl(C2, C1), X);
----------------
bcl5980 wrote:
> @lebedev.ri @spatel 
> Based on the rules, can we remove this one-use also ?
> (C2 << X) << C1 dependent on C2 << X
> (C2 << C1) << X is independent with C2 << X
> 
> One similar case udiv+lshr, do we need add one-use if we add the transform?
> https://alive2.llvm.org/ce/z/wk6n3q
add general proof for udiv+lshr:
https://alive2.llvm.org/ce/z/CfMqxN


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D124183



More information about the llvm-commits mailing list