[mlir] Propagate NaNs in PolynomialApproximation
authorTres Popp <tpopp@google.com>
Thu, 17 Feb 2022 09:20:50 +0000 (10:20 +0100)
committerTres Popp <tpopp@google.com>
Fri, 18 Feb 2022 08:25:36 +0000 (09:25 +0100)
commitf5efe2807056d3fa525e51d35ea94c91e0945eb2
tree07e86914f4b3f24f38c867b3bba35d04d377b557
parentb529744c29a87d8ecf4336e751fee794df10ec7f
[mlir] Propagate NaNs in PolynomialApproximation

Previously, NaNs would be dropped in favor of bounded values which was
strictly incorrect. Now the min/max operation propagate this
information. Not all uses of min/max need this, but the given change
will help protect future additions, and this prevents the need for an
additional cmpf and select operation to handle NaNs.

Differential Revision: https://reviews.llvm.org/D120020
mlir/lib/Dialect/Math/Transforms/PolynomialApproximation.cpp
mlir/test/Dialect/Math/polynomial-approximation.mlir
mlir/test/mlir-cpu-runner/math-polynomial-approx.mlir