[PATCH] D148674: ValueTracking: Handle frem in computeKnownFPClass

Jay Foad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 25 05:58:17 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;
+      }
----------------
arsenm wrote:
> foad wrote:
> > fcPosZero seems wrong. Wouldn't the result be -0 if X is -ve?
> No, the signs cancel and the divide is exact. The only case to worry about would be frem -0, -0 but that's nan.
That seems to contradict "the result has the same sign as x". Surely that implies that -1 frem -1 is -0.


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

https://reviews.llvm.org/D148674



More information about the llvm-commits mailing list