diff --git a/mlir/lib/Dialect/SCF/SCF.cpp b/mlir/lib/Dialect/SCF/SCF.cpp index 54c93e93f37e8a..7bb2df9137e45d 100644 --- a/mlir/lib/Dialect/SCF/SCF.cpp +++ b/mlir/lib/Dialect/SCF/SCF.cpp @@ -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(it.index()); Value initVal, yieldOpArg; std::tie(initVal, yieldOpArg) = it.value(); @@ -2437,7 +2438,8 @@ struct RemoveLoopInvariantArgsFromBeforeBlock SmallVector newInitArgs, newYieldOpArgs; DenseMap beforeBlockInitValMap; SmallVector 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(it.index()); Value initVal, yieldOpArg; std::tie(initVal, yieldOpArg) = it.value(); @@ -2574,7 +2576,7 @@ struct RemoveLoopInvariantValueYielded : public OpRewritePattern { SmallVector newAfterBlockType; DenseMap condOpInitValMap; SmallVector newAfterBlockArgLocs; - for (auto it : llvm::enumerate(condOpArgs)) { + for (const auto &it : llvm::enumerate(condOpArgs)) { auto index = static_cast(it.index()); Value condOpArg = it.value(); // Those values not defined within `before` block will be considered as