[llvm] [ConstantFold] Fold `log1p` and `log1pf` when the input parameter is a constant value. (PR #112113)
via llvm-commits
llvm-commits at lists.llvm.org
Sun Oct 13 02:57:21 PDT 2024
================
@@ -2394,6 +2395,11 @@ static Constant *ConstantFoldScalarCall1(StringRef Name,
if (!APF.isZero() && TLI->has(Func))
return ConstantFoldFP(logb, APF, Ty);
break;
+ case LibFunc_log1p:
+ case LibFunc_log1pf:
+ if (APF > APFloat(APF.getSemantics(), "-1") && TLI->has(Func))
----------------
c8ef wrote:
Using `-1` directly seems to pick a different constructor and not achieve the intended behavior. Using `-1.0` will pick a deleted constructor, so I opted to use `"-1"` here.
https://github.com/llvm/llvm-project/pull/112113
More information about the llvm-commits
mailing list