[PATCH] D149185: ValueTracking: Fix computeKnownFPClass handling for copysign

Jay Foad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 26 01:23:21 PDT 2023


foad added inline comments.


================
Comment at: llvm/include/llvm/Analysis/ValueTracking.h:399-402
+    if (Sign.isKnownNever(fcPositive))
+      KnownFPClasses &= (fcNegative | fcNan);
+    if (Sign.isKnownNever(fcNegative))
+      KnownFPClasses &= (fcPositive | fcNan);
----------------
This doesn't work. `Sign.isKnownNever(fcPositive)` does not guarantee that the sign bit of Sign is 1, since it could be a nan with the sign bit clear.

I guess you meant `Sign.isKnownNever(fcPositive | fcNan)`? But this is another case where you could test `Sign.SignBit && *Sign.SignBit` as well or instead, since there is redundancy in the representation.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D149185/new/

https://reviews.llvm.org/D149185



More information about the llvm-commits mailing list