[PATCH] D148599: ValueTrackng: Handle sign bit for fptrunc
Jay Foad via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 18 02:38:22 PDT 2023
foad added a comment.
I feel like there are undocumented assumptions here.
Does fptrunc +/- 0.0 preserve sign?
Is Known.SignBit supposed to be accurate even for Nans? That seems unfortunate, since for a lot of operations you won't be able to propagate it unless you can prove something isn't Nan.
================
Comment at: llvm/lib/Analysis/ValueTracking.cpp:4083
+ // Sign should be preserved
+ if (KnownSrc.cannotBeOrderedLessThanZero())
+ Known.knownNot(NegExcept0);
----------------
Writing this as `KnownSrc.isKnownNot(NegExcept0)` would make it clearer that the source and result classes are the same here.
Also why can't this logic be mirrored for PosExcept0?
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D148599/new/
https://reviews.llvm.org/D148599
More information about the llvm-commits
mailing list