This is an archive of the discontinued LLVM Phabricator instance.

ValueTracking: Handle powi in computeKnownFPClass
ClosedPublic

Authored by arsenm on Apr 18 2023, 1:12 PM.

Details

Summary

Extract the handling from cannotBeOrderedLessThanZeroImpl and
avoid the mentioned -0 bug.

Diff Detail

Event Timeline

arsenm created this revision.Apr 18 2023, 1:12 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 18 2023, 1:12 PM
arsenm requested review of this revision.Apr 18 2023, 1:12 PM
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 19 2023, 1:47 AM
llvm/lib/Analysis/ValueTracking.cpp
4561

This is checking that bit 0 is the only bit known to be zero. I think you want ExponentKnownBits.Zero[0].

4562

I don't think the result can be -0 here either, can it?

4577–4579

I think this simplifies to:

if (KnownSrc.isKnownNot(fcNegative))
  Known.knownNot(fcNegative);
4582–4584

Remove this?

arsenm marked 2 inline comments as done.Apr 24 2023, 2:52 PM
arsenm added inline comments.
llvm/lib/Analysis/ValueTracking.cpp
4562

I think -0 requires an odd exp so yes

4577–4579

I was trying to avoid handling the denormals flush case but I think a mode check is still needed.

arsenm updated this revision to Diff 516556.Apr 24 2023, 3:39 PM
arsenm added inline comments.
llvm/lib/Analysis/ValueTracking.cpp
4577–4579

don't think denormal matters after all

foad added inline comments.Apr 25 2023, 1:18 AM
llvm/lib/Analysis/ValueTracking.cpp
4551
4576

Passing InterestedClasses doesn't really work here if it is only a subset of fcNegative.

arsenm updated this revision to Diff 516758.Apr 25 2023, 5:24 AM
arsenm marked 2 inline comments as done.
foad accepted this revision.Apr 25 2023, 5:57 AM
This revision is now accepted and ready to land.Apr 25 2023, 5:57 AM