[llvm] [InstCombine] Fold abs(a * abs(b)) --> abs(a * b) (PR #78110)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 13 20:06:42 PST 2024
================
@@ -1601,6 +1601,15 @@ Instruction *InstCombinerImpl::visitCallInst(CallInst &CI) {
return CastInst::Create(Instruction::ZExt, NarrowAbs, II->getType());
}
+ // abs(a * abs(b)) --> abs(a * b)
+ Value *A, *B;
+ if (match(IIOperand,
+ m_OneUse(m_c_Mul(m_Value(A),
+ m_Intrinsic<Intrinsic::abs>(m_Value(B)))))) {
+ Value *New = Builder.CreateMul(A, B);
----------------
goldsteinn wrote:
can you add this?
https://github.com/llvm/llvm-project/pull/78110
More information about the llvm-commits
mailing list