Skip to content

Commit 5378706

Browse files
committed
[NFC][mlir][math] Minor code cleanup in AlgebraicSimplification
1 parent e974c65 commit 5378706

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

mlir/lib/Dialect/Math/Transforms/AlgebraicSimplification.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ PowFStrengthReduction::matchAndRewrite(math::PowFOp op,
6666
// Maybe broadcasts scalar value into vector type compatible with `op`.
6767
auto bcast = [&](Value value) -> Value {
6868
if (auto vec = dyn_cast<VectorType>(op.getType()))
69-
return vector::BroadcastOp::create(rewriter, op.getLoc(), vec, value);
69+
return vector::BroadcastOp::create(rewriter, loc, vec, value);
7070
return value;
7171
};
7272

@@ -84,8 +84,7 @@ PowFStrengthReduction::matchAndRewrite(math::PowFOp op,
8484

8585
// Replace `pow(x, 3.0)` with `x * x * x`.
8686
if (isExponentValue(3.0)) {
87-
Value square =
88-
arith::MulFOp::create(rewriter, op.getLoc(), ValueRange({x, x}));
87+
Value square = arith::MulFOp::create(rewriter, loc, ValueRange({x, x}));
8988
rewriter.replaceOpWithNewOp<arith::MulFOp>(op, ValueRange({x, square}));
9089
return success();
9190
}
@@ -113,8 +112,8 @@ PowFStrengthReduction::matchAndRewrite(math::PowFOp op,
113112

114113
// Replace `pow(x, 0.75)` with `sqrt(sqrt(x)) * sqrt(x)`.
115114
if (isExponentValue(0.75)) {
116-
Value powHalf = math::SqrtOp::create(rewriter, op.getLoc(), x);
117-
Value powQuarter = math::SqrtOp::create(rewriter, op.getLoc(), powHalf);
115+
Value powHalf = math::SqrtOp::create(rewriter, loc, x);
116+
Value powQuarter = math::SqrtOp::create(rewriter, loc, powHalf);
118117
rewriter.replaceOpWithNewOp<arith::MulFOp>(op,
119118
ValueRange{powHalf, powQuarter});
120119
return success();

0 commit comments

Comments
 (0)