[llvm] [ValueTracking][KnownFPClass] Cover known no-infinity cases for powi (PR #191736)

Max Graey via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 14 05:14:02 PDT 2026


================
@@ -880,6 +879,39 @@ KnownFPClass KnownFPClass::powi(const KnownFPClass &KnownSrc,
     return Known;
   }
 
+  // powi(x, exp) --> inf
+  // when:
+  //   * powi(inf, exp), exp > 0
+  //   * powi(+/-0, exp), exp < 0
----------------
MaxGraey wrote:

It might seem a bit counterintuitive, but it’s correct. Just simple examples for `exp == 2`:
```
inf ** +2 -> inf
inf ** -2 -> 0
```
godbolt: https://godbolt.org/z/851o9bTY6

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


More information about the llvm-commits mailing list