This is an archive of the discontinued LLVM Phabricator instance.

ValueTracking: Implement computeKnownFPClass for various rounding intrinsics
ClosedPublic

Authored by arsenm on Apr 10 2023, 5:46 AM.

Diff Detail

Event Timeline

arsenm created this revision.Apr 10 2023, 5:46 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 10 2023, 5:46 AM
arsenm requested review of this revision.Apr 10 2023, 5:46 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
arsenm updated this revision to Diff 516891.Apr 25 2023, 1:47 PM

Stronger sign handling which avoids regressions when old functions are replaced

kpn added inline comments.May 3 2023, 10:44 AM
llvm/lib/Analysis/ValueTracking.cpp
4897

Couldn't a subnormal value be the input for rounding? The result won't be subnormal, but why remove the checks for subnormal inputs?

arsenm updated this revision to Diff 522535.May 16 2023, 4:16 AM
arsenm marked an inline comment as done.

Denormal inputs

arsenm updated this revision to Diff 522542.May 16 2023, 4:35 AM
arsenm added a reviewer: foad.
foad added inline comments.May 16 2023, 6:18 AM
llvm/lib/Analysis/ValueTracking.cpp
4873–4874

This doesn't seem to match the code any more? I guess you want:

if (InterestedClass & fcPosFinite)
  InterestedSrcs |= fcPosFinite;

etc.

(Strictly I think you ought to do this for fcNan too, throughout computeKnownFPClass, in case InterestedClasses only contains one of fcSNan or fcQNan.)

arsenm added inline comments.May 16 2023, 6:57 AM
llvm/lib/Analysis/ValueTracking.cpp
4873–4874

I don't see the point of enabling more bits here, not sure why I put this here in the first place

arsenm updated this revision to Diff 522596.May 16 2023, 6:57 AM
foad added inline comments.May 17 2023, 1:54 AM
llvm/lib/Analysis/ValueTracking.cpp
4873–4874

The point is that if you're only interested in whether the result is (say) negzero, you can't prove that unless you know the source is none of negzero|negsubnormal|negfinite. Isn't that the way InterestedClasses is supposed to work?

arsenm updated this revision to Diff 522983.May 17 2023, 3:38 AM

Enable more interested

arsenm updated this revision to Diff 522986.May 17 2023, 3:40 AM
foad accepted this revision.May 17 2023, 4:53 AM
This revision is now accepted and ready to land.May 17 2023, 4:53 AM