[llvm] [InstCombine]combine mul(abs(x), abs(y)) to abs(mul(x, y)) (PR #78395)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 17 01:23:17 PST 2024
================
@@ -330,6 +330,23 @@ Instruction *InstCombinerImpl::visitMul(BinaryOperator &I) {
return BinaryOperator::CreateMul(X, X);
}
+ {
+ Value *X, *Y, *Z;
+ // abs(X) * abs(Y) -> abs(X * Y)
+ // nabs(X) * nabs(Y) -> abs(X * Y)
+ SelectPatternFlavor SPF0 = matchSelectPattern(Op0, X, Z).Flavor;
+ SelectPatternFlavor SPF1 = matchSelectPattern(Op1, Y, Z).Flavor;
+ if ((SPF0 == SPF1) && (SPF0 == SPF_ABS || SPF0 == SPF_NABS))
----------------
nikic wrote:
Remove SPF handling.
https://github.com/llvm/llvm-project/pull/78395
More information about the llvm-commits
mailing list