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

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 30 13:08:34 PDT 2018


spatel added inline comments.


================
Comment at: lib/Analysis/InstructionSimplify.cpp:3573
       switch (Pred) {
+      case FCmpInst::FCMP_OGE:
+        if (FMF.noNaNs() && CannotBeOrderedLessThanZero(LHS, Q.TLI))
----------------
mcberg2017 wrote:
> 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?
I'm not seeing the alternative to using CannotBeOrderedLessThanZero for this case. Did you have something in mind?
I agree that we're probably missing an additional fold for 'OLT' and/or 'ULT' here, but I wanted to make sure we're ok with this example first.


https://reviews.llvm.org/D53874





More information about the llvm-commits mailing list