[llvm] [InstCombine] Fold `(X * (Y << K)) u>> K -> X * Y` when highbits are not demanded (PR #111151)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 4 07:51:22 PDT 2024
================
@@ -770,6 +770,15 @@ Value *InstCombinerImpl::SimplifyDemandedUseBits(Instruction *I,
return InsertNewInstWith(Shl, I->getIterator());
}
}
+
+ const APInt *Factor;
+ if (match(I->getOperand(0),
+ m_OneUse(m_Mul(m_Value(X), m_APInt(Factor)))) &&
+ Factor->countr_zero() >= ShiftAmt) {
+ BinaryOperator *Mul = BinaryOperator::CreateMul(
----------------
goldsteinn wrote:
Can we put the two impls in the same place?
https://github.com/llvm/llvm-project/pull/111151
More information about the llvm-commits
mailing list