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

Mehdi Amini llvmlistbot at llvm.org
Wed May 18 09:16:43 PDT 2022


Author: Mehdi Amini
Date: 2022-05-18T16:15:46Z
New Revision: e1ff449ec9272bf9af6a0eab5240775b9a8a09fc

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

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

Added: 
    

Modified: 
    mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp b/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp
index 0acd1b931fa6..70437c6caa19 100644
--- a/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp
+++ b/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp
@@ -919,7 +919,7 @@ struct DeduplicateAndRemoveDeadOperandsAndResults
       // - it is not used in the payload, and
       // - the corresponding indexing maps are not needed for loop bound
       //   computation.
-      for (auto outputOpOperand :
+      for (const auto &outputOpOperand :
            llvm::enumerate(genericOp.getOutputOperands())) {
         unprocessedIndexingMaps = unprocessedIndexingMaps.drop_front();
         Value result = genericOp.getResult(outputOpOperand.index());
@@ -985,7 +985,8 @@ struct DeduplicateAndRemoveDeadOperandsAndResults
       SmallVector<Value> newYieldVals;
       YieldOp origYieldOp = cast<YieldOp>(block->getTerminator());
       rewriter.setInsertionPoint(origYieldOp);
-      for (auto yieldOpOperands : llvm::enumerate(origYieldOp.values())) {
+      for (const auto &yieldOpOperands :
+           llvm::enumerate(origYieldOp.values())) {
         if (!droppedOutputs.count(yieldOpOperands.index())) {
           newYieldVals.push_back(yieldOpOperands.value());
           continue;
@@ -997,7 +998,7 @@ struct DeduplicateAndRemoveDeadOperandsAndResults
     // Replace all live uses of the op.
     SmallVector<Value> replacementsVals(genericOp->getNumResults(), nullptr);
     unsigned newResultNum = 0;
-    for (auto result : llvm::enumerate(genericOp.getResults()))
+    for (const auto &result : llvm::enumerate(genericOp.getResults()))
       if (!droppedOutputs.count(result.index()))
         replacementsVals[result.index()] = newOp.getResult(newResultNum++);
     rewriter.replaceOp(genericOp, replacementsVals);


        


More information about the Mlir-commits mailing list