[PATCH] D148674: ValueTracking: Handle frem in computeKnownFPClass

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 25 19:29:55 PDT 2023


arsenm 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;
+      }
----------------
foad wrote:
> 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.
Yes, -1%-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