[PATCH] D45976: [InstCombine] Simplify Add with remainder expressions as operands.
Bixia Zheng via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 24 09:33:39 PDT 2018
bixia added inline comments.
================
Comment at: lib/Transforms/InstCombine/InstCombineAddSub.cpp:1047
+ ConstantInt *CI;
+ if (match(E, m_Mul(m_Value(*Op), m_ConstantInt(CI))) ||
+ match(E, m_Mul(m_ConstantInt(CI), m_Value(*Op)))) {
----------------
sanjoy wrote:
> lebedev.ri wrote:
> > `m_c_Mul()`
> > And please make sure that there is a test for both combinations.
> I'm not sure if `m_c_Mul` is necessary here -- we should be canonicalizing multiplications such that the constant operand, if there is any, is always the RHS.
I removed one of the two m_Mul assuming that the operation is canonicalized.
================
Comment at: lib/Transforms/InstCombine/InstCombineAddSub.cpp:1085
+ if (IsSigned && match(E, m_SDiv(m_Value(*Op), m_ConstantInt(CI)))) {
+ C = CI->getZExtValue();
+ return true;
----------------
craig.topper wrote:
> What guarantees the ConstantInt only uses 64 bits or less?
Changed to use APInt instead.
Repository:
rL LLVM
https://reviews.llvm.org/D45976
More information about the llvm-commits
mailing list