[PATCH] D148230: ValueTracking: fadd +0 cannot return -0
Jay Foad via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 20 02:48:34 PDT 2023
foad added inline comments.
================
Comment at: llvm/lib/Analysis/ValueTracking.cpp:4369
+ if (KnownRHS.KnownFPClasses == fcPosZero)
+ Known.knownNot(fcNegZero);
+
----------------
First, this is wrong for FSub, since -0 - +0 = -0
Second, you can generalize `KnownRHS.KnownFPClasses == fcPosZero` to `KnownRHS.isKnownNot(fcNegZero)` (or `fcPosZero` for FSub).
Third you could do a similar check on the LHS. For both FAdd and FSub, if the LHS is not -0 then the result can't be -0.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D148230/new/
https://reviews.llvm.org/D148230
More information about the llvm-commits
mailing list