diff options
author | Sanjay Patel <spatel@rotateright.com> | 2019-06-09 13:48:59 +0000 |
---|---|---|
committer | Sanjay Patel <spatel@rotateright.com> | 2019-06-09 13:48:59 +0000 |
commit | 73f5a855b33358b6d44b91d9ac6199a9ce2ba1b6 (patch) | |
tree | de25e06b8db70696a12e1b68bebc0653f891b4d3 /llvm/lib/Analysis/InstructionSimplify.cpp | |
parent | de4d4d5049e50bf0947a775facc5e0ca221f69da (diff) | |
download | llvm-73f5a855b33358b6d44b91d9ac6199a9ce2ba1b6.zip llvm-73f5a855b33358b6d44b91d9ac6199a9ce2ba1b6.tar.gz llvm-73f5a855b33358b6d44b91d9ac6199a9ce2ba1b6.tar.bz2 |
[InstSimplify] enhance fcmp fold with never-nan operand
This is another step towards correcting our usage of fast-math-flags when applied on an fcmp.
In this case, we are checking for 'nnan' on the fcmp itself rather than the operand of
the fcmp. But I'm leaving that clause in until we're more confident that we can stop
relying on fcmp's FMF.
By using the more general "isKnownNeverNaN()", we gain a simplification shown on the
tests with 'uitofp' regardless of the FMF on the fcmp (uitofp never produces a NaN).
On the tests with 'fabs', we are now relying on the FMF for the call fabs instruction
in addition to the FMF on the fcmp.
This is a continuation of D62979 / rL362879.
llvm-svn: 362903
Diffstat (limited to 'llvm/lib/Analysis/InstructionSimplify.cpp')
-rw-r--r-- | llvm/lib/Analysis/InstructionSimplify.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/Analysis/InstructionSimplify.cpp b/llvm/lib/Analysis/InstructionSimplify.cpp index 47369db..ad9d40b 100644 --- a/llvm/lib/Analysis/InstructionSimplify.cpp +++ b/llvm/lib/Analysis/InstructionSimplify.cpp @@ -3486,8 +3486,8 @@ static Value *SimplifyFCmpInst(unsigned Predicate, Value *LHS, Value *RHS, return getTrue(RetTy); break; case FCmpInst::FCMP_ULT: - // TODO: This should match 'oge'. - if (FMF.noNaNs() && CannotBeOrderedLessThanZero(LHS, Q.TLI)) + if ((FMF.noNaNs() || isKnownNeverNaN(LHS, Q.TLI)) && + CannotBeOrderedLessThanZero(LHS, Q.TLI)) return getFalse(RetTy); break; case FCmpInst::FCMP_OLT: |