[llvm] [KnownFPClass] Fix fsub input denormal handling (PR #225605)

Eric Ross via llvm-commits llvm-commits at lists.llvm.org
Sun Oct 11 14:59:33 PDT 2026


================
@@ -494,47 +494,59 @@ static KnownFPClass fadd_impl(const KnownFPClass &KnownLHS,
       Known.knownNot(fcZero | fcNegSubnormal);
   }
 
+  if (!IsFMA) {
+    // (fadd x, +0.0) is guaranteed to return +0.0, not -0.0.
+    if (KnownLHS.isKnownNeverNegZero() || KnownRHS.isKnownNeverNegZero())
----------------
ZERICO2005 wrote:

Ping @arsenm, would you be able to take another look? Does my reply above answer your question about using `isKnownNeverNegZero` instead of the `isKnownNeverLogical*` checks in `fadd_impl`?

Also, we could remove `isKnownNeverZero` in a follow up, to force people to pick and choose between `isKnownNeverLogicalZero` and `isKnownNever(fcZero)`.

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


More information about the llvm-commits mailing list