aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/ConstantFolding.cpp
diff options
context:
space:
mode:
authorc8ef <c8ef@outlook.com>2024-11-01 09:26:11 +0800
committerGitHub <noreply@github.com>2024-11-01 09:26:11 +0800
commitcf0b6cc7118634d73ba186f50d06e191f49da82a (patch)
tree49c8bafd542c531a47b9e8896802d39234483e7b /llvm/lib/Analysis/ConstantFolding.cpp
parent1f07f995cc994dfb46b65fe97986efca15cf304b (diff)
downloadllvm-cf0b6cc7118634d73ba186f50d06e191f49da82a.zip
llvm-cf0b6cc7118634d73ba186f50d06e191f49da82a.tar.gz
llvm-cf0b6cc7118634d73ba186f50d06e191f49da82a.tar.bz2
Revert "[ConstantFold] Fold `tgamma` and `tgammaf` when the input parameter is a constant value." (#114496)
Reverts llvm/llvm-project#114065
Diffstat (limited to 'llvm/lib/Analysis/ConstantFolding.cpp')
-rw-r--r--llvm/lib/Analysis/ConstantFolding.cpp19
1 files changed, 3 insertions, 16 deletions
diff --git a/llvm/lib/Analysis/ConstantFolding.cpp b/llvm/lib/Analysis/ConstantFolding.cpp
index a96c3be..c5a2c2f 100644
--- a/llvm/lib/Analysis/ConstantFolding.cpp
+++ b/llvm/lib/Analysis/ConstantFolding.cpp
@@ -57,7 +57,6 @@
#include <cassert>
#include <cerrno>
#include <cfenv>
-#include <cfloat>
#include <cmath>
#include <cstdint>
@@ -1699,9 +1698,9 @@ bool llvm::canConstantFoldCallTo(const CallBase *Call, const Function *F) {
Name == "sinh" || Name == "sinhf" ||
Name == "sqrt" || Name == "sqrtf";
case 't':
- return Name == "tan" || Name == "tanf" || Name == "tanh" ||
- Name == "tanhf" || Name == "trunc" || Name == "truncf" ||
- Name == "tgamma" || Name == "tgammaf";
+ return Name == "tan" || Name == "tanf" ||
+ Name == "tanh" || Name == "tanhf" ||
+ Name == "trunc" || Name == "truncf";
case '_':
// Check for various function names that get used for the math functions
// when the header files are preprocessed with the macro
@@ -2418,14 +2417,6 @@ static Constant *ConstantFoldScalarCall1(StringRef Name,
if (TLI->has(Func))
return ConstantFoldFP(erf, APF, Ty);
break;
- case LibFunc_tgamma:
- case LibFunc_tgammaf:
- // NOTE: These boundaries are somewhat conservative.
- if (TLI->has(Func) &&
- (Ty->isDoubleTy() && APF > APFloat(DBL_MIN) && APF < APFloat(171.0) ||
- Ty->isFloatTy() && APF > APFloat(FLT_MIN) && APF < APFloat(35.0f)))
- return ConstantFoldFP(tgamma, APF, Ty);
- break;
case LibFunc_nearbyint:
case LibFunc_nearbyintf:
case LibFunc_rint:
@@ -3638,10 +3629,6 @@ bool llvm::isMathLibCallNoop(const CallBase *Call,
case LibFunc_sqrtf:
return Op.isNaN() || Op.isZero() || !Op.isNegative();
- case LibFunc_tgamma:
- case LibFunc_tgammaf:
- return true;
-
// FIXME: Add more functions: sqrt_finite, atanh, expm1, log1p,
// maybe others?
default: