[llvm] [InstCombine] Add fold for fabs(-x) -> fabs(x) (PR #95627)

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 14 19:42:54 PDT 2024


================
@@ -2511,6 +2511,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))))
----------------
dtcxzyw wrote:

The comment https://github.com/llvm/llvm-project/pull/94183#discussion_r1624729580 is not resolved.


https://github.com/llvm/llvm-project/pull/95627


More information about the llvm-commits mailing list