[PATCH] D148674: ValueTracking: Handle frem in computeKnownFPClass

Jay Foad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 25 01:14:03 PDT 2023


foad added inline comments.


================
Comment at: llvm/lib/Analysis/ValueTracking.cpp:4699
+        // X % X is always exactly 0.0 or a NaN.
+        Known.KnownFPClasses = fcNan | fcPosZero;
+      }
----------------
fcPosZero seems wrong. Wouldn't the result be -0 if X is -ve?


================
Comment at: llvm/lib/Analysis/ValueTracking.cpp:4734
+    if (Op->getOpcode() == Instruction::FDiv) {
+      // Only 0/0, Inf/Inf, Inf REM x and x REM 0 produce NaN.
+      if (KnownLHS.isKnownNeverNaN() && KnownRHS.isKnownNeverNaN() &&
----------------
Remove REM part of comment?


================
Comment at: llvm/lib/Analysis/ValueTracking.cpp:4743
 
-    // X / -0.0 is -Inf (or NaN).
-    if (KnownLHS.isKnownNever(fcNegative) && KnownRHS.isKnownNever(fcNegative))
-      Known.knownNot(fcNegative);
+      // X / -0.0 is -Inf (or NaN).
+      if (KnownLHS.isKnownNever(fcNegative) && KnownRHS.isKnownNever(fcNegative))
----------------
Comment should just say that +ve / +ve is +ve.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D148674/new/

https://reviews.llvm.org/D148674



More information about the llvm-commits mailing list