[llvm] [APFloat] Add `APFloat::getConstant` for C++20 <numbers> constants (PR #227916)
Eric Ross via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 30 17:57:41 PDT 2026
================
@@ -2829,8 +2829,11 @@ Value *LibCallSimplifier::optimizeLog(CallInst *Log, IRBuilderBase &B) {
ArgID == Intrinsic::exp || ArgID == Intrinsic::exp2) {
Constant *Eul;
if (ArgLb == ExpLb || ArgID == Intrinsic::exp)
- // FIXME: Add more precise value of e for long double.
- Eul = ConstantFP::get(Log->getType(), numbers::e);
+ Eul = ConstantFP::get(
+ Log->getType(),
+ APFloat::getConstant(
+ APFloat::MathConstant::e,
+ Log->getType()->getScalarType()->getFltSemantics()));
----------------
ZERICO2005 wrote:
Should we add `ConstantFP::getConstant`?
https://github.com/llvm/llvm-project/pull/227916
More information about the llvm-commits
mailing list