[llvm] [InstCombine] Add fold for fabs(-x) -> fabs(x) (PR #94183)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 3 09:16:59 PDT 2024
================
@@ -2517,6 +2517,13 @@ Instruction *InstCombinerImpl::visitCallInst(CallInst &CI) {
}
case Intrinsic::fabs: {
Value *Cond, *TVal, *FVal;
+ Value* Arg = II->getArgOperand(0);
+ Value* X;
+ // fabs (-X) --> fabs (X)
+ if (match(Arg, m_FNeg(m_Value(X)))) {
----------------
arsenm wrote:
Somewhere is a strip sign operations helper function that also covers copysign
https://github.com/llvm/llvm-project/pull/94183
More information about the llvm-commits
mailing list