This is an archive of the discontinued LLVM Phabricator instance.

ValueTracking: Improve trunc handling in computeKnownFPClass
ClosedPublic

Authored by arsenm on Apr 17 2023, 7:23 AM.

Diff Detail

Event Timeline

arsenm created this revision.Apr 17 2023, 7:23 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 17 2023, 7:23 AM
arsenm requested review of this revision.Apr 17 2023, 7:23 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
foad added inline comments.Apr 17 2023, 8:20 AM
llvm/lib/Analysis/ValueTracking.cpp
4720

This seems wrong - the result could be poszero if the input is poszero.

Same for negzero below.

4726

Seems reasonable but is this actually documented anywhere (when the result is zero)?

arsenm marked 2 inline comments as done.Apr 25 2023, 3:57 AM
arsenm added inline comments.
llvm/lib/Analysis/ValueTracking.cpp
4726

Spec states:

The trunc functions use IEC 60559 rounding toward zero (regardless of the current
rounding direction).
— trunc(±0) returns ±0.
— trunc(±∞) returns ±∞.

arsenm updated this revision to Diff 516736.Apr 25 2023, 3:57 AM
arsenm marked an inline comment as done.

Fix 0

foad accepted this revision.Apr 25 2023, 6:10 AM
foad added inline comments.
llvm/lib/Analysis/ValueTracking.cpp
4698

If InterestedClasses includes Zero you should add Subnormal and Normal.

This revision is now accepted and ready to land.Apr 25 2023, 6:10 AM