[Mlir-commits] [mlir] e188ad8 - Apply clang-tidy fixes for performance-unnecessary-value-param in SplitReduction.cpp (NFC)
Mehdi Amini
llvmlistbot at llvm.org
Tue Apr 12 00:47:32 PDT 2022
Author: Mehdi Amini
Date: 2022-04-12T07:47:04Z
New Revision: e188ad8bf049558bed5fd580b8060dc04d7a8d11
URL: https://github.com/llvm/llvm-project/commit/e188ad8bf049558bed5fd580b8060dc04d7a8d11
DIFF: https://github.com/llvm/llvm-project/commit/e188ad8bf049558bed5fd580b8060dc04d7a8d11.diff
LOG: Apply clang-tidy fixes for performance-unnecessary-value-param in SplitReduction.cpp (NFC)
Added:
Modified:
mlir/include/mlir/Dialect/Linalg/Transforms/Transforms.h
mlir/lib/Dialect/Linalg/Transforms/SplitReduction.cpp
Removed:
################################################################################
diff --git a/mlir/include/mlir/Dialect/Linalg/Transforms/Transforms.h b/mlir/include/mlir/Dialect/Linalg/Transforms/Transforms.h
index 168ad3c12628b..b4fefc21132e7 100644
--- a/mlir/include/mlir/Dialect/Linalg/Transforms/Transforms.h
+++ b/mlir/include/mlir/Dialect/Linalg/Transforms/Transforms.h
@@ -1404,8 +1404,8 @@ using ControlSplitReductionFn =
/// Patterns to apply `splitReduction` below.
void populateSplitReductionPattern(
RewritePatternSet &patterns,
- ControlSplitReductionFn controlSplitReductionFn,
- LinalgTransformationFilter f = LinalgTransformationFilter());
+ const ControlSplitReductionFn &controlSplitReductionFn,
+ const LinalgTransformationFilter &f = LinalgTransformationFilter());
/// Apply transformation to split the single linalg op reduction into a parallel
/// and reduction dimension. Then create a new linalg.generic op doing the rest
@@ -1448,8 +1448,8 @@ void populateSplitReductionPattern(
/// ```
FailureOr<LinalgOp>
splitReduction(PatternRewriter &b, LinalgOp op,
- ControlSplitReductionFn controlSplitReductionFn,
- LinalgTransformationFilter f);
+ const ControlSplitReductionFn &controlSplitReductionFn,
+ const LinalgTransformationFilter &f);
} // namespace linalg
} // namespace mlir
diff --git a/mlir/lib/Dialect/Linalg/Transforms/SplitReduction.cpp b/mlir/lib/Dialect/Linalg/Transforms/SplitReduction.cpp
index edfe80ca337aa..8f94de4abd1ff 100644
--- a/mlir/lib/Dialect/Linalg/Transforms/SplitReduction.cpp
+++ b/mlir/lib/Dialect/Linalg/Transforms/SplitReduction.cpp
@@ -11,6 +11,8 @@
//
//===----------------------------------------------------------------------===//
+#include <utility>
+
#include "mlir/Analysis/SliceAnalysis.h"
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
#include "mlir/Dialect/Linalg/IR/Linalg.h"
@@ -54,10 +56,10 @@ static Optional<Attribute> getIdentity(Operation *op) {
return llvm::None;
}
-FailureOr<LinalgOp>
-mlir::linalg::splitReduction(PatternRewriter &b, LinalgOp op,
- ControlSplitReductionFn controlSplitReductionFn,
- LinalgTransformationFilter filter) {
+FailureOr<LinalgOp> mlir::linalg::splitReduction(
+ PatternRewriter &b, LinalgOp op,
+ const ControlSplitReductionFn &controlSplitReductionFn,
+ const LinalgTransformationFilter &filter) {
if (failed(filter.checkAndNotify(b, op)) || !op.hasTensorSemantics() ||
op.getNumReductionLoops() != 1 || op.getNumOutputs() != 1 ||
!op.hasOnlyProjectedPermutations())
@@ -210,8 +212,8 @@ struct LinalgSplitReduction : public OpInterfaceRewritePattern<LinalgOp> {
ControlSplitReductionFn controlSplitReductionFn,
LinalgTransformationFilter f, PatternBenefit benefit = 1)
: OpInterfaceRewritePattern<LinalgOp>(context, benefit),
- controlSplitReductionFn(controlSplitReductionFn), filter(std::move(f)) {
- }
+ controlSplitReductionFn(std::move(controlSplitReductionFn)),
+ filter(std::move(f)) {}
LogicalResult matchAndRewrite(LinalgOp op,
PatternRewriter &rewriter) const override {
@@ -227,8 +229,8 @@ struct LinalgSplitReduction : public OpInterfaceRewritePattern<LinalgOp> {
void linalg::populateSplitReductionPattern(
RewritePatternSet &patterns,
- ControlSplitReductionFn controlSplitReductionFn,
- LinalgTransformationFilter f) {
+ const ControlSplitReductionFn &controlSplitReductionFn,
+ const LinalgTransformationFilter &f) {
patterns.add<LinalgSplitReduction>(patterns.getContext(),
controlSplitReductionFn, f);
}
More information about the Mlir-commits
mailing list