[llvm] [Support][ValueTraking] Improve KnownFPClass for fadd. Handle infinity signs (PR #190559)

Max Graey via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 6 05:59:13 PDT 2026


================
@@ -127,6 +127,17 @@ struct KnownFPClass {
     return isKnownNever(OrderedGreaterThanZeroMask);
   }
 
+  /// Return true if it's known this can never be a positive value or a logical
+  /// 0.
+  ///
+  ///      NaN --> true
+  ///  x <= +0 --> false
+  ///     psub --> true if mode is ieee, false otherwise.
+  ///   x > +0 --> true
+  bool cannotBeOrderedLessEqZero(DenormalMode Mode) const {
+    return isKnownNever(fcNegative) && isKnownNeverLogicalPosZero(Mode);
----------------
MaxGraey wrote:

Hmm, I'm not sure. I just follow by the existing [`cannotBeOrderedGreaterEqZero`](https://github.com/llvm/llvm-project/blob/b6e7c475cb44057c71297e38833ffc448194c002/llvm/include/llvm/Support/KnownFPClass.h#L137) semantics. And it seems that this stricter semantics was implemented intentionally. 

Basically, this method can be removed; I used it for some additional checks that I later decided against. But I thought it would be useful to have a corresponding method, `cannotBeOrderedGreaterEqZero`, for future use.

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


More information about the llvm-commits mailing list