Apply clang-tidy fixes for performance-unnecessary-value-param in SplitReduction.cpp (NFC)

This commit is contained in:
Mehdi Amini 2022-04-03 23:03:41 +00:00
parent 30846d2916
commit e188ad8bf0
2 changed files with 14 additions and 12 deletions

View File

@ -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

View File

@ -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 @@ private:
void linalg::populateSplitReductionPattern(
RewritePatternSet &patterns,
ControlSplitReductionFn controlSplitReductionFn,
LinalgTransformationFilter f) {
const ControlSplitReductionFn &controlSplitReductionFn,
const LinalgTransformationFilter &f) {
patterns.add<LinalgSplitReduction>(patterns.getContext(),
controlSplitReductionFn, f);
}