Skip to content

Commit cf0b6cc

Browse files
authored
Revert "[ConstantFold] Fold tgamma and tgammaf when the input parameter is a constant value." (llvm#114496)
Reverts llvm#114065
1 parent 1f07f99 commit cf0b6cc

File tree

2 files changed

+3
-271
lines changed

2 files changed

+3
-271
lines changed

llvm/lib/Analysis/ConstantFolding.cpp

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@
5757
#include <cassert>
5858
#include <cerrno>
5959
#include <cfenv>
60-
#include <cfloat>
6160
#include <cmath>
6261
#include <cstdint>
6362

@@ -1699,9 +1698,9 @@ bool llvm::canConstantFoldCallTo(const CallBase *Call, const Function *F) {
16991698
Name == "sinh" || Name == "sinhf" ||
17001699
Name == "sqrt" || Name == "sqrtf";
17011700
case 't':
1702-
return Name == "tan" || Name == "tanf" || Name == "tanh" ||
1703-
Name == "tanhf" || Name == "trunc" || Name == "truncf" ||
1704-
Name == "tgamma" || Name == "tgammaf";
1701+
return Name == "tan" || Name == "tanf" ||
1702+
Name == "tanh" || Name == "tanhf" ||
1703+
Name == "trunc" || Name == "truncf";
17051704
case '_':
17061705
// Check for various function names that get used for the math functions
17071706
// when the header files are preprocessed with the macro
@@ -2418,14 +2417,6 @@ static Constant *ConstantFoldScalarCall1(StringRef Name,
24182417
if (TLI->has(Func))
24192418
return ConstantFoldFP(erf, APF, Ty);
24202419
break;
2421-
case LibFunc_tgamma:
2422-
case LibFunc_tgammaf:
2423-
// NOTE: These boundaries are somewhat conservative.
2424-
if (TLI->has(Func) &&
2425-
(Ty->isDoubleTy() && APF > APFloat(DBL_MIN) && APF < APFloat(171.0) ||
2426-
Ty->isFloatTy() && APF > APFloat(FLT_MIN) && APF < APFloat(35.0f)))
2427-
return ConstantFoldFP(tgamma, APF, Ty);
2428-
break;
24292420
case LibFunc_nearbyint:
24302421
case LibFunc_nearbyintf:
24312422
case LibFunc_rint:
@@ -3638,10 +3629,6 @@ bool llvm::isMathLibCallNoop(const CallBase *Call,
36383629
case LibFunc_sqrtf:
36393630
return Op.isNaN() || Op.isZero() || !Op.isNegative();
36403631

3641-
case LibFunc_tgamma:
3642-
case LibFunc_tgammaf:
3643-
return true;
3644-
36453632
// FIXME: Add more functions: sqrt_finite, atanh, expm1, log1p,
36463633
// maybe others?
36473634
default:

llvm/test/Transforms/InstCombine/tgamma.ll

Lines changed: 0 additions & 255 deletions
This file was deleted.

0 commit comments

Comments
 (0)