[llvm] [ConstantFold] Fold `log1p` and `log1pf` when the input parameter is a constant value. (PR #112113)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Sun Oct 13 02:06:40 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))
----------------
arsenm wrote:

Avoid the string? Also still fold if call is memory none 

https://github.com/llvm/llvm-project/pull/112113


More information about the llvm-commits mailing list