aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacques Pienaar <jpienaar@google.com>2023-06-24 17:03:37 -0700
committerJacques Pienaar <jpienaar@google.com>2023-06-24 17:03:39 -0700
commit75bd41f61d3247d4394ad0c46d23cc7c62261d63 (patch)
treeb10622c6a64047b2aecda03e4b94266f1ece4daa
parent080fa1ee38d65c84212fa5eb19c43bc10637fd75 (diff)
downloadllvm-75bd41f61d3247d4394ad0c46d23cc7c62261d63.zip
llvm-75bd41f61d3247d4394ad0c46d23cc7c62261d63.tar.gz
llvm-75bd41f61d3247d4394ad0c46d23cc7c62261d63.tar.bz2
[mlir][polyapprox] Use llvm::numbers for constants.
Fixes windows build.
-rw-r--r--mlir/lib/Dialect/Math/Transforms/PolynomialApproximation.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/mlir/lib/Dialect/Math/Transforms/PolynomialApproximation.cpp b/mlir/lib/Dialect/Math/Transforms/PolynomialApproximation.cpp
index d48a6fa..533b14e 100644
--- a/mlir/lib/Dialect/Math/Transforms/PolynomialApproximation.cpp
+++ b/mlir/lib/Dialect/Math/Transforms/PolynomialApproximation.cpp
@@ -33,6 +33,7 @@
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/STLExtras.h"
+#include "llvm/Support/MathExtras.h"
using namespace mlir;
using namespace mlir::math;
@@ -441,11 +442,11 @@ AtanApproximation::matchAndRewrite(math::AtanOp op,
ans0 = builder.create<math::FmaOp>(ans0, x, x);
// Correct for the input mapping's angles:
- Value mpi4 = bcast(f32Cst(builder, M_PI_4));
+ Value mpi4 = bcast(f32Cst(builder, llvm::numbers::pi / 4));
Value ans2 = builder.create<arith::AddFOp>(mpi4, ans0);
Value ans = builder.create<arith::SelectOp>(cmp2, ans2, ans0);
- Value mpi2 = bcast(f32Cst(builder, M_PI_2));
+ Value mpi2 = bcast(f32Cst(builder, llvm::numbers::pi / 2));
Value ans1 = builder.create<arith::SubFOp>(mpi2, ans0);
ans = builder.create<arith::SelectOp>(cmp1, ans1, ans);