[llvm] [InstCombine] Add fold for fabs(-x) -> fabs(x) (PR #94183)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 3 02:08:52 PDT 2024
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff 718331f55529469586c99a55e4b382a1c7485842 73d52ca113af478a784042d7317e48d7978a9e27 -- llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
index 1e06296c77..fbcbe77d79 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
@@ -2517,11 +2517,12 @@ Instruction *InstCombinerImpl::visitCallInst(CallInst &CI) {
}
case Intrinsic::fabs: {
Value *Cond, *TVal, *FVal;
- Value* Arg = II->getArgOperand(0);
- Value* X;
+ Value *Arg = II->getArgOperand(0);
+ Value *X;
// fabs (-X) --> fabs (X)
if (match(Arg, m_FNeg(m_Value(X)))) {
- return replaceInstUsesWith(CI, Builder.CreateUnaryIntrinsic(Intrinsic::fabs, X));
+ return replaceInstUsesWith(
+ CI, Builder.CreateUnaryIntrinsic(Intrinsic::fabs, X));
}
if (match(II->getArgOperand(0),
``````````
</details>
https://github.com/llvm/llvm-project/pull/94183
More information about the llvm-commits
mailing list