[llvm] [Transforms] Add cos(fabs(x)) -> cos(x) to SimplifyLibCalls (PR #79699)

via llvm-commits llvm-commits at lists.llvm.org
Sat Jan 27 09:41:31 PST 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 19146b97127157bda97ad87b94f3c4c9bf7e81d4 7b739ce87120bf1373a04ef489fc14f0ab25f2bb -- llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp b/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
index 29f7e596f4..bf19a4129d 100644
--- a/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
+++ b/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
@@ -1936,7 +1936,8 @@ static Value *optimizeTrigReflections(CallInst *Call, LibFunc Func,
   case LibFunc_cosl:
     // cos(-X) --> cos(X)
     // cos(fabs(x)) -> cos(x)
-    if (match(Call->getArgOperand(0), m_FNeg(m_Value(X))) || match(Call->getArgOperand(0), m_FAbs(m_Value(X))))
+    if (match(Call->getArgOperand(0), m_FNeg(m_Value(X))) ||
+        match(Call->getArgOperand(0), m_FAbs(m_Value(X))))
       return copyFlags(*Call,
                        B.CreateCall(Call->getCalledFunction(), X, "cos"));
     break;

``````````

</details>


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


More information about the llvm-commits mailing list