[llvm] [ConstantantFolding] Add support for `sinh` and `cosh` intrinsics constant folding (PR #132671)
via llvm-commits
llvm-commits at lists.llvm.org
Sun Mar 23 22:07:12 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-analysis
Author: Iris (el-ev)
<details>
<summary>Changes</summary>
Closes #<!-- -->132503.
---
Full diff: https://github.com/llvm/llvm-project/pull/132671.diff
1 Files Affected:
- (modified) llvm/lib/Analysis/ConstantFolding.cpp (+6)
``````````diff
diff --git a/llvm/lib/Analysis/ConstantFolding.cpp b/llvm/lib/Analysis/ConstantFolding.cpp
index b0ba25c3c16ac..dc905ab03e861 100644
--- a/llvm/lib/Analysis/ConstantFolding.cpp
+++ b/llvm/lib/Analysis/ConstantFolding.cpp
@@ -1651,6 +1651,8 @@ bool llvm::canConstantFoldCallTo(const CallBase *Call, const Function *F) {
case Intrinsic::sin:
case Intrinsic::cos:
case Intrinsic::sincos:
+ case Intrinsic::sinh:
+ case Intrinsic::cosh:
case Intrinsic::pow:
case Intrinsic::powi:
case Intrinsic::ldexp:
@@ -2513,6 +2515,10 @@ static Constant *ConstantFoldScalarCall1(StringRef Name,
return ConstantFoldFP(sin, APF, Ty);
case Intrinsic::cos:
return ConstantFoldFP(cos, APF, Ty);
+ case Intrinsic::sinh:
+ return ConstantFoldFP(sinh, APF, Ty);
+ case Intrinsic::cosh:
+ return ConstantFoldFP(cosh, APF, Ty);
case Intrinsic::sqrt:
return ConstantFoldFP(sqrt, APF, Ty);
case Intrinsic::amdgcn_cos:
``````````
</details>
https://github.com/llvm/llvm-project/pull/132671
More information about the llvm-commits
mailing list