[Mlir-commits] [mlir] 4e888e2 - [MLIR] NFC. Fix clang-tidy warnings in Affine Utils

Uday Bondhugula llvmlistbot at llvm.org
Fri Oct 6 02:57:56 PDT 2023


Author: Uday Bondhugula
Date: 2023-10-06T15:27:22+05:30
New Revision: 4e888e20928da011d8f8f8de1a5cc06a072d6000

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

LOG: [MLIR] NFC. Fix clang-tidy warnings in Affine Utils

Added: 
    

Modified: 
    mlir/lib/Dialect/Affine/Utils/Utils.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Dialect/Affine/Utils/Utils.cpp b/mlir/lib/Dialect/Affine/Utils/Utils.cpp
index 346320cf5bbaa82..a6df512897eccaf 100644
--- a/mlir/lib/Dialect/Affine/Utils/Utils.cpp
+++ b/mlir/lib/Dialect/Affine/Utils/Utils.cpp
@@ -1431,20 +1431,18 @@ void mlir::affine::createAffineComputationSlice(
   // 
diff er from opInst's operands only for those operands in 'subOperands', for
   // which they will be replaced by the corresponding one from 'sliceOps'.
   SmallVector<Value, 4> newOperands(opInst->getOperands());
-  for (unsigned i = 0, e = newOperands.size(); i < e; i++) {
+  for (Value &operand : newOperands) {
     // Replace the subOperands from among the new operands.
     unsigned j, f;
     for (j = 0, f = subOperands.size(); j < f; j++) {
-      if (newOperands[i] == subOperands[j])
+      if (operand == subOperands[j])
         break;
     }
-    if (j < subOperands.size()) {
-      newOperands[i] = (*sliceOps)[j];
-    }
+    if (j < subOperands.size())
+      operand = (*sliceOps)[j];
   }
-  for (unsigned idx = 0, e = newOperands.size(); idx < e; idx++) {
+  for (unsigned idx = 0, e = newOperands.size(); idx < e; idx++)
     opInst->setOperand(idx, newOperands[idx]);
-  }
 }
 
 /// Enum to set patterns of affine expr in tiled-layout map.


        


More information about the Mlir-commits mailing list