[PATCH] D53874: [InstSimplify] fold 'fcmp nnan oge X, 0.0' when X is not negative

Michael Berg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 30 11:21:28 PDT 2018


mcberg2017 added inline comments.


================
Comment at: lib/Analysis/InstructionSimplify.cpp:3573
       switch (Pred) {
+      case FCmpInst::FCMP_OGE:
+        if (FMF.noNaNs() && CannotBeOrderedLessThanZero(LHS, Q.TLI))
----------------
Sure NaNs are compared as unordered so excluding them is ok. Discussion point: If X has value below -0.0, CannotBeOrderedLessThanZero will return false if it can prove it, however so will the comparison of X > 0 as an ordered compare.  Now we no longer have to prove X is a NaN in CannotBeOrderedLessThanZero as we specify/assert it is not.   Do we need CannotBeOrderedLessThanZero for this comparison?


https://reviews.llvm.org/D53874





More information about the llvm-commits mailing list