[llvm] [ConstantFolding] Fold expm1/expm1f with constant arguments (PR #196717)

Iris Shi via llvm-commits llvm-commits at lists.llvm.org
Sun May 10 02:27:32 PDT 2026


================
@@ -4789,6 +4795,9 @@ bool llvm::isMathLibCallNoop(const CallBase *Call,
         if (OpC->getType()->isFloatTy())
           return !(Op < APFloat(-149.0f) || Op > APFloat(127.0f));
         break;
+      case LibFunc_expm1:
+      case LibFunc_expm1f:
+        return true;
----------------
el-ev wrote:

This is not correct. It shouldn’t fold when the result overflows. Please compare with the lines for `LibFunc_exp*` above, and add a similar range check.

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


More information about the llvm-commits mailing list