[PATCH] D139130: InstCombine: Fold and (fcmp), (is.fpclass) into is.fpclass

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 13 08:07:19 PST 2022


arsenm added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp:1243
+      return {LHS, fcZero};
+    case FCmpInst::FCMP_UEQ: // match !(x != 0.0)
+      return {LHS, fcZero | fcNan};
----------------
foad wrote:
> arsenm wrote:
> > foad wrote:
> > > Using `!=` in the comment is misleading since that is true for nans. Maybe use `<>` instead or just spell out what you mean.
> > It's not misleading, that this is true for nans is the point. It's the negation of the usual syntactic ordered compare
> This comment is misleading: `case FCmpInst::FCMP_UEQ: // match !(x != 0.0)`
> 
> `!(x != 0.0)` (in C) is the same as `x == 0.0` (in C) which is OEQ not UEQ.
No, they aren't the same in C. This whole conversation is why this comment is necessary

https://alive2.llvm.org/ce/z/gtzLUh


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

https://reviews.llvm.org/D139130



More information about the llvm-commits mailing list