[Mlir-commits] [mlir] 6120bd4 - Apply clang-tidy fixes for performance-for-range-copy in ElementwiseOpFusion.cpp (NFC)

Mehdi Amini llvmlistbot at llvm.org
Mon Apr 18 17:48:12 PDT 2022


Author: Mehdi Amini
Date: 2022-04-19T00:47:58Z
New Revision: 6120bd47039d741e2713d153a6f7096635b354ee

URL: https://github.com/llvm/llvm-project/commit/6120bd47039d741e2713d153a6f7096635b354ee
DIFF: https://github.com/llvm/llvm-project/commit/6120bd47039d741e2713d153a6f7096635b354ee.diff

LOG: Apply clang-tidy fixes for performance-for-range-copy in ElementwiseOpFusion.cpp (NFC)

Added: 
    

Modified: 
    mlir/lib/Dialect/Linalg/Transforms/ElementwiseOpFusion.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Dialect/Linalg/Transforms/ElementwiseOpFusion.cpp b/mlir/lib/Dialect/Linalg/Transforms/ElementwiseOpFusion.cpp
index b97e654bae4b5..3aabac2ba456a 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<int64_t> 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 @@ class CollapsingInfo {
                  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<int64_t, unsigned>(foldedDims.index(), dim.index());
     }


        


More information about the Mlir-commits mailing list