[mlir][SCF] Apply suggested ClangTidy fixes.
authorAdrian Kuegel <akuegel@google.com>
Thu, 24 Feb 2022 07:22:13 +0000 (08:22 +0100)
committerAdrian Kuegel <akuegel@google.com>
Thu, 24 Feb 2022 07:23:24 +0000 (08:23 +0100)
mlir/lib/Dialect/SCF/SCF.cpp

index 54c93e9..7bb2df9 100644 (file)
@@ -2406,7 +2406,8 @@ struct RemoveLoopInvariantArgsFromBeforeBlock
     ValueRange yieldOpArgs = yieldOp->getOperands();
 
     bool canSimplify = false;
-    for (auto it : llvm::enumerate(llvm::zip(op.getOperands(), yieldOpArgs))) {
+    for (const auto &it :
+         llvm::enumerate(llvm::zip(op.getOperands(), yieldOpArgs))) {
       auto index = static_cast<unsigned>(it.index());
       Value initVal, yieldOpArg;
       std::tie(initVal, yieldOpArg) = it.value();
@@ -2437,7 +2438,8 @@ struct RemoveLoopInvariantArgsFromBeforeBlock
     SmallVector<Value> newInitArgs, newYieldOpArgs;
     DenseMap<unsigned, Value> beforeBlockInitValMap;
     SmallVector<Location> newBeforeBlockArgLocs;
-    for (auto it : llvm::enumerate(llvm::zip(op.getOperands(), yieldOpArgs))) {
+    for (const auto &it :
+         llvm::enumerate(llvm::zip(op.getOperands(), yieldOpArgs))) {
       auto index = static_cast<unsigned>(it.index());
       Value initVal, yieldOpArg;
       std::tie(initVal, yieldOpArg) = it.value();
@@ -2574,7 +2576,7 @@ struct RemoveLoopInvariantValueYielded : public OpRewritePattern<WhileOp> {
     SmallVector<Type> newAfterBlockType;
     DenseMap<unsigned, Value> condOpInitValMap;
     SmallVector<Location> newAfterBlockArgLocs;
-    for (auto it : llvm::enumerate(condOpArgs)) {
+    for (const auto &it : llvm::enumerate(condOpArgs)) {
       auto index = static_cast<unsigned>(it.index());
       Value condOpArg = it.value();
       // Those values not defined within `before` block will be considered as