[PATCH] D62979: [InstSimplify] enhance/fix fcmp fold with never-nan operand

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 7 09:26:59 PDT 2019


spatel marked an inline comment as done.
spatel added inline comments.


================
Comment at: llvm/test/Transforms/InstSimplify/floating-point-compare.ll:371
+; CHECK-NEXT:    ret i1 [[CMP]]
 ;
   %fabs = tail call double @llvm.fabs.f64(double %x)
----------------
cameron.mcinally wrote:
> Why can't we infer that the operand here is >=0 (from the fabs) and not a NaN (from the fcmp's nnan)? Is it not safe to combine that information? 
> 
> I suppose a poison value could be lost...
We're trying to move away from the specialized usage of FMF on fcmp because that introduces strangeness like:
https://bugs.llvm.org/show_bug.cgi?id=38086

More discussion here:
https://reviews.llvm.org/D61917

But now that I'm looking at this again, it would be better to split this change into 2 parts:
(1) add the check for isKnownNeverNan()
(2) remove the check for FMF on the fcmp

...because I'm not sure if we will introduce regressions by not checking for FMF on fcmp. We need to get further along with propagating/using FMF on select and possibly other instructions before we tighten up the fcmp semantics.


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

https://reviews.llvm.org/D62979





More information about the llvm-commits mailing list