-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[ConstantFolding] Add support for sinh
and cosh
intrinsics in constant folding
#132671
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…constant folding
@llvm/pr-subscribers-llvm-transforms @llvm/pr-subscribers-llvm-analysis Author: Iris (el-ev) ChangesCloses #132503. Full diff: https://github.com/llvm/llvm-project/pull/132671.diff 1 Files Affected:
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:
|
llvm/test/Transforms/InstSimplify/ConstProp/sinh-cosh-intrinsics.ll
Outdated
Show resolved
Hide resolved
You can test this locally with the following command:git diff -U0 --pickaxe-regex -S '([^a-zA-Z0-9#_-]undef[^a-zA-Z0-9_-]|UndefValue::get)' 'HEAD~1' HEAD llvm/test/Transforms/InstSimplify/ConstProp/sinh-cosh-intrinsics.ll llvm/lib/Analysis/ConstantFolding.cpp The following files introduce new uses of undef:
Undef is now deprecated and should only be used in the rare cases where no replacement is possible. For example, a load of uninitialized memory yields In tests, avoid using For example, this is considered a bad practice: define void @fn() {
...
br i1 undef, ...
} Please use the following instead: define void @fn(i1 %cond) {
...
br i1 %cond, ...
} Please refer to the Undefined Behavior Manual for more information. |
0e1681e
to
6e6cb21
Compare
6e6cb21
to
be4d06c
Compare
sinh
and cosh
intrinsics constant foldingsinh
and cosh
intrinsics in constant folding
ping |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Closes #132503.