[llvm] [ConstantFolding] Add edge cases for llvm.log{, 2, 10} (PR #173304)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 23 13:07:15 PST 2025


================
@@ -2719,11 +2719,29 @@ static Constant *ConstantFoldScalarCall1(StringRef Name,
     switch (IntrinsicID) {
       default: break;
       case Intrinsic::log:
+        if (U.isZero())
+          return ConstantFP::getInfinity(Ty, true);
+        if (U.isNegative())
+          return ConstantFP::getNaN(Ty);
+        if (U.isExactlyValue(1))
----------------
arsenm wrote:

```suggestion
        if (U.isExactlyValue(1.0))
```

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


More information about the llvm-commits mailing list