[Mlir-commits] [mlir] 75bd41f - [mlir][polyapprox] Use llvm::numbers for constants.
Jacques Pienaar
llvmlistbot at llvm.org
Sat Jun 24 17:04:14 PDT 2023
Author: Jacques Pienaar
Date: 2023-06-24T17:03:39-07:00
New Revision: 75bd41f61d3247d4394ad0c46d23cc7c62261d63
URL: https://github.com/llvm/llvm-project/commit/75bd41f61d3247d4394ad0c46d23cc7c62261d63
DIFF: https://github.com/llvm/llvm-project/commit/75bd41f61d3247d4394ad0c46d23cc7c62261d63.diff
LOG: [mlir][polyapprox] Use llvm::numbers for constants.
Fixes windows build.
Added:
Modified:
mlir/lib/Dialect/Math/Transforms/PolynomialApproximation.cpp
Removed:
################################################################################
diff --git a/mlir/lib/Dialect/Math/Transforms/PolynomialApproximation.cpp b/mlir/lib/Dialect/Math/Transforms/PolynomialApproximation.cpp
index d48a6fae0a30d..533b14e061e93 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);
More information about the Mlir-commits
mailing list