This is an archive of the discontinued LLVM Phabricator instance.

ValueTracking: Handle fptrunc in computeKnownFPClass
ClosedPublic

Authored by arsenm on Apr 10 2023, 6:54 AM.

Details

Diff Detail

Event Timeline

arsenm created this revision.Apr 10 2023, 6:54 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 10 2023, 6:54 AM
arsenm requested review of this revision.Apr 10 2023, 6:54 AM
Herald added a reviewer: sstefan1. · View Herald Transcript
Herald added a project: Restricted Project. · View Herald Transcript
Herald added a subscriber: wdng. · View Herald Transcript
kpn added inline comments.Apr 12 2023, 11:17 AM
llvm/lib/Analysis/ValueTracking.cpp
4649

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?

arsenm added inline comments.Apr 12 2023, 12:38 PM
llvm/lib/Analysis/ValueTracking.cpp
4649

fptrunc(inf) => inf so there isn't really an issue as much of a missing optimization

arsenm updated this revision to Diff 512970.Apr 12 2023, 2:03 PM

Handle infinities

kpn accepted this revision.Apr 13 2023, 6:21 AM

LGTM

This revision is now accepted and ready to land.Apr 13 2023, 6:21 AM
kpn added inline comments.Apr 13 2023, 6:38 AM
llvm/lib/Analysis/ValueTracking.cpp
4649

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?

arsenm updated this revision to Diff 513378.Apr 13 2023, 3:49 PM
arsenm added inline comments.
llvm/lib/Analysis/ValueTracking.cpp
4649

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

arsenm requested review of this revision.Apr 13 2023, 3:54 PM
kpn accepted this revision.Apr 14 2023, 8:20 AM

LGTM "for reals" this time.

This revision is now accepted and ready to land.Apr 14 2023, 8:20 AM