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

Jay Foad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 13 08:15:31 PST 2022


foad 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};
----------------
arsenm wrote:
> 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
Yes they are the same in C: https://godbolt.org/z/1rq9GTjEM

`!=` in C is UNE not ONE.


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

https://reviews.llvm.org/D139130



More information about the llvm-commits mailing list