From: Mehdi Amini Date: Sat, 16 Apr 2022 07:33:20 +0000 (+0000) Subject: Apply clang-tidy fixes for performance-for-range-copy in ElementwiseOpFusion.cpp... X-Git-Tag: upstream/15.0.7~10126 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6120bd47039d741e2713d153a6f7096635b354ee;p=platform%2Fupstream%2Fllvm.git Apply clang-tidy fixes for performance-for-range-copy in ElementwiseOpFusion.cpp (NFC) --- diff --git a/mlir/lib/Dialect/Linalg/Transforms/ElementwiseOpFusion.cpp b/mlir/lib/Dialect/Linalg/Transforms/ElementwiseOpFusion.cpp index b97e654..3aabac2 100644 --- a/mlir/lib/Dialect/Linalg/Transforms/ElementwiseOpFusion.cpp +++ b/mlir/lib/Dialect/Linalg/Transforms/ElementwiseOpFusion.cpp @@ -1277,7 +1277,7 @@ getCollapsableIterationSpaceDims(GenericOp genericOp, OpOperand *fusableOperand, // Compute all the loops with the reduction iterator types. SmallVector reductionDims; - for (auto iteratorType : llvm::enumerate(genericOp.iterator_types())) { + for (const auto &iteratorType : llvm::enumerate(genericOp.iterator_types())) { if (isReductionIterator(iteratorType.value())) { reductionDims.push_back(iteratorType.index()); } @@ -1320,7 +1320,7 @@ getCollapsableIterationSpaceDims(GenericOp genericOp, OpOperand *fusableOperand, // using a more strict definition of reduction for now. if (isReductionIterator(startIteratorType)) { bool isContiguous = false; - for (auto startDim : llvm::enumerate(reductionDims)) { + for (const auto &startDim : llvm::enumerate(reductionDims)) { // Move window in `reductionDims` to start of the folded iteration dims. if (startDim.value() != foldedIterationSpaceDims[0]) continue; @@ -1331,7 +1331,8 @@ getCollapsableIterationSpaceDims(GenericOp genericOp, OpOperand *fusableOperand, break; // Check that the contiguity is maintained. isContiguous = true; - for (auto foldedDim : llvm::enumerate(foldedIterationSpaceDims)) { + for (const auto &foldedDim : + llvm::enumerate(foldedIterationSpaceDims)) { if (reductionDims[foldedDim.index() + startDim.index()] != foldedDim.value()) { isContiguous = false; @@ -1398,8 +1399,9 @@ public: return lhs[0] < rhs[0]; }); origOpToCollapsedOpIterationDim.resize(origNumLoops); - for (auto foldedDims : llvm::enumerate(collapsedOpToOrigOpIterationDim)) { - for (auto dim : enumerate(foldedDims.value())) + for (const auto &foldedDims : + llvm::enumerate(collapsedOpToOrigOpIterationDim)) { + for (const auto &dim : enumerate(foldedDims.value())) origOpToCollapsedOpIterationDim[dim.value()] = std::make_pair(foldedDims.index(), dim.index()); }