[PATCH] D147939: ValueTracking: Handle fptrunc in computeKnownFPClass

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 13 15:49:14 PDT 2023


arsenm added inline comments.


================
Comment at: llvm/lib/Analysis/ValueTracking.cpp:4627
+    if (KnownSrc.isKnownNeverNaN())
+      Known.knownNot(fcNan);
+    break;
----------------
kpn wrote:
> arsenm wrote:
> > kpn wrote:
> > > Isn't infinity an issue as well? If the input to be truncated is zero then we know the result can't be infinity. Then again, if the goal is to keep parity with the old implementation then do we need to worry about infinity yet?
> > fptrunc(inf) => inf so there isn't really an issue as much of a missing optimization 
> Wait, it's possible for a non-infinity value to be truncated to a value that is infinity in the smaller format, no? Shouldn't we just be checking that the value is in range, or just checking for zero if that's too much work?
Yes, this is just broken. I got it right before and then corrected into wrong. isKnownNeverInfinity has a comment about this. We don't have infrastructure to check ranges 


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

https://reviews.llvm.org/D147939



More information about the llvm-commits mailing list