[Mlir-commits] [mlir] 61f0677 - Apply clang-tidy fixes for performance-unnecessary-value-param in VectorDistribute.cpp (NFC)
Mehdi Amini
llvmlistbot at llvm.org
Wed Sep 7 17:05:42 PDT 2022
Author: Mehdi Amini
Date: 2022-09-08T00:05:22Z
New Revision: 61f06774ff60d7c221cc1acb5fd24a0e04ad6fe9
URL: https://github.com/llvm/llvm-project/commit/61f06774ff60d7c221cc1acb5fd24a0e04ad6fe9
DIFF: https://github.com/llvm/llvm-project/commit/61f06774ff60d7c221cc1acb5fd24a0e04ad6fe9.diff
LOG: Apply clang-tidy fixes for performance-unnecessary-value-param in VectorDistribute.cpp (NFC)
Added:
Modified:
mlir/include/mlir/Dialect/Vector/Transforms/VectorDistribution.h
mlir/lib/Dialect/Vector/Transforms/VectorDistribute.cpp
Removed:
################################################################################
diff --git a/mlir/include/mlir/Dialect/Vector/Transforms/VectorDistribution.h b/mlir/include/mlir/Dialect/Vector/Transforms/VectorDistribution.h
index d3220ceb43f67..9174d0e2ab53e 100644
--- a/mlir/include/mlir/Dialect/Vector/Transforms/VectorDistribution.h
+++ b/mlir/include/mlir/Dialect/Vector/Transforms/VectorDistribution.h
@@ -76,8 +76,9 @@ using DistributedReductionFn =
/// Collect patterns to distribute vector reduction ops using given lamdba to
/// distribute reduction op.
-void populateDistributeReduction(RewritePatternSet &pattern,
- DistributedReductionFn distributedReductionFn);
+void populateDistributeReduction(
+ RewritePatternSet &pattern,
+ const DistributedReductionFn &distributedReductionFn);
} // namespace vector
} // namespace mlir
diff --git a/mlir/lib/Dialect/Vector/Transforms/VectorDistribute.cpp b/mlir/lib/Dialect/Vector/Transforms/VectorDistribute.cpp
index 22cabaf979e37..712fc69422cff 100644
--- a/mlir/lib/Dialect/Vector/Transforms/VectorDistribute.cpp
+++ b/mlir/lib/Dialect/Vector/Transforms/VectorDistribute.cpp
@@ -201,7 +201,7 @@ static bool canBeHoisted(Operation *op,
/// Return a value yielded by `warpOp` which statifies the filter lamdba
/// condition and is not dead.
static OpOperand *getWarpResult(WarpExecuteOnLane0Op warpOp,
- std::function<bool(Operation *)> fn) {
+ const std::function<bool(Operation *)> &fn) {
auto yield = cast<vector::YieldOp>(
warpOp.getBodyRegion().getBlocks().begin()->getTerminator());
for (OpOperand &yieldOperand : yield->getOpOperands()) {
@@ -986,7 +986,7 @@ struct WarpOpReduction : public OpRewritePattern<WarpExecuteOnLane0Op> {
DistributedReductionFn distributedReductionFn,
PatternBenefit benefit = 1)
: OpRewritePattern<WarpExecuteOnLane0Op>(context, benefit),
- distributedReductionFn(distributedReductionFn) {}
+ distributedReductionFn(std::move(distributedReductionFn)) {}
LogicalResult matchAndRewrite(WarpExecuteOnLane0Op warpOp,
PatternRewriter &rewriter) const override {
@@ -1071,7 +1071,7 @@ void mlir::vector::populatePropagateWarpVectorDistributionPatterns(
void mlir::vector::populateDistributeReduction(
RewritePatternSet &patterns,
- DistributedReductionFn distributedReductionFn) {
+ const DistributedReductionFn &distributedReductionFn) {
patterns.add<WarpOpReduction>(patterns.getContext(), distributedReductionFn);
}
More information about the Mlir-commits
mailing list