OSDN Git Service

[InstSimplify] enhance fcmp fold with never-nan operand
authorSanjay Patel <spatel@rotateright.com>
Sat, 8 Jun 2019 15:12:33 +0000 (15:12 +0000)
committerSanjay Patel <spatel@rotateright.com>
Sat, 8 Jun 2019 15:12:33 +0000 (15:12 +0000)
commit51431e756c1b2f1e22c1d9f533a18a5c4bf3d445
tree0844ce3416505a33fe777fba0c76193039fbd20c
parente3ed75170d6f81caf59c90e8079b7cffbc825173
[InstSimplify] enhance fcmp fold with never-nan operand

This is 1 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.

I'll update the 'ult' case below here as a follow-up assuming no problems here.

Differential Revision: https://reviews.llvm.org/D62979

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@362879 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Analysis/InstructionSimplify.cpp
test/Transforms/InstSimplify/floating-point-compare.ll