[Mlir-commits] [mlir] 07628a9 - [mlir] Apply ClangTidyPerformance findings (NFC)
Adrian Kuegel
llvmlistbot at llvm.org
Mon Jul 25 01:50:16 PDT 2022
Author: Adrian Kuegel
Date: 2022-07-25T10:50:04+02:00
New Revision: 07628a94e8ccca78e2e0422836666128b5b61078
URL: https://github.com/llvm/llvm-project/commit/07628a94e8ccca78e2e0422836666128b5b61078
DIFF: https://github.com/llvm/llvm-project/commit/07628a94e8ccca78e2e0422836666128b5b61078.diff
LOG: [mlir] Apply ClangTidyPerformance findings (NFC)
Added:
Modified:
mlir/lib/Dialect/Linalg/Transforms/DecomposeLinalgOps.cpp
mlir/lib/Dialect/Linalg/Transforms/TilingInterfaceImpl.cpp
Removed:
################################################################################
diff --git a/mlir/lib/Dialect/Linalg/Transforms/DecomposeLinalgOps.cpp b/mlir/lib/Dialect/Linalg/Transforms/DecomposeLinalgOps.cpp
index 4f7f865b9c23e..1f5fef6873174 100644
--- a/mlir/lib/Dialect/Linalg/Transforms/DecomposeLinalgOps.cpp
+++ b/mlir/lib/Dialect/Linalg/Transforms/DecomposeLinalgOps.cpp
@@ -117,7 +117,7 @@ SmallVector<OpFoldResult> permuteValues(ArrayRef<OpFoldResult> values,
AffineMap map) {
assert(map.isPermutation());
SmallVector<OpFoldResult> permutedValues(values.size());
- for (auto position :
+ for (const auto &position :
llvm::enumerate(llvm::map_range(map.getResults(), [](AffineExpr expr) {
return expr.cast<AffineDimExpr>().getPosition();
})))
@@ -334,7 +334,7 @@ DecomposeLinalgOp::matchAndRewrite(GenericOp genericOp,
/// In the split operations, replace block arguments uses that refer to
/// original operation to the block arguments of the newly created operation.
unsigned origNumInputs = genericOp.getNumInputs();
- for (auto inputBlockArg :
+ for (const auto &inputBlockArg :
llvm::enumerate(genericOp.getBody()->getArguments())) {
Value residualOpReplacementArg =
residualGenericOpBody->getArgument(inputBlockArg.index());
@@ -356,7 +356,7 @@ DecomposeLinalgOp::matchAndRewrite(GenericOp genericOp,
/// corresponding result have to be remapped to result of the generic op for
/// the peeled operation.
SmallVector<Value> replacements;
- for (auto yieldValue : llvm::enumerate(yieldOp->getOperands())) {
+ for (const auto &yieldValue : llvm::enumerate(yieldOp->getOperands())) {
OpResult opr = yieldValue.value().dyn_cast<OpResult>();
if (!opr || opr.getOwner() != peeledScalarOperation)
replacements.push_back(residualGenericOp.getResult(yieldValue.index()));
diff --git a/mlir/lib/Dialect/Linalg/Transforms/TilingInterfaceImpl.cpp b/mlir/lib/Dialect/Linalg/Transforms/TilingInterfaceImpl.cpp
index 06d5f752c463f..c6b8e5f4b8b24 100644
--- a/mlir/lib/Dialect/Linalg/Transforms/TilingInterfaceImpl.cpp
+++ b/mlir/lib/Dialect/Linalg/Transforms/TilingInterfaceImpl.cpp
@@ -160,12 +160,12 @@ struct LinalgOpTilingInterface
if (!indexingMap.isPermutation()) {
SmallVector<Range> iterationDomain =
tilingInterfaceOp.getIterationDomain(b);
- for (auto range : llvm::enumerate(iterationDomain)) {
+ for (const auto &range : llvm::enumerate(iterationDomain)) {
iterationTileOffsets[range.index()] = range.value().offset;
iterationTileSizes[range.index()] = range.value().size;
}
}
- for (auto resultExpr : llvm::enumerate(indexingMap.getResults())) {
+ for (const auto &resultExpr : llvm::enumerate(indexingMap.getResults())) {
unsigned dimPosition =
resultExpr.value().cast<AffineDimExpr>().getPosition();
iterationTileOffsets[dimPosition] = offsets[resultExpr.index()];
More information about the Mlir-commits
mailing list