diff --git a/mlir/lib/Dialect/Linalg/Transforms/DecomposeLinalgOps.cpp b/mlir/lib/Dialect/Linalg/Transforms/DecomposeLinalgOps.cpp index 4f7f865b9c23..1f5fef687317 100644 --- a/mlir/lib/Dialect/Linalg/Transforms/DecomposeLinalgOps.cpp +++ b/mlir/lib/Dialect/Linalg/Transforms/DecomposeLinalgOps.cpp @@ -117,7 +117,7 @@ SmallVector permuteValues(ArrayRef values, AffineMap map) { assert(map.isPermutation()); SmallVector permutedValues(values.size()); - for (auto position : + for (const auto &position : llvm::enumerate(llvm::map_range(map.getResults(), [](AffineExpr expr) { return expr.cast().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 replacements; - for (auto yieldValue : llvm::enumerate(yieldOp->getOperands())) { + for (const auto &yieldValue : llvm::enumerate(yieldOp->getOperands())) { OpResult opr = yieldValue.value().dyn_cast(); 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 06d5f752c463..c6b8e5f4b8b2 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 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().getPosition(); iterationTileOffsets[dimPosition] = offsets[resultExpr.index()];