[Mlir-commits] [mlir] 7e61d89 - [mlir] Apply ClangTidy performance finding
Adrian Kuegel
llvmlistbot at llvm.org
Thu Oct 24 05:33:56 PDT 2024
Author: Adrian Kuegel
Date: 2024-10-24T12:32:49Z
New Revision: 7e61d893739ff309a1c2e01dee31b1a5e6ed91b8
URL: https://github.com/llvm/llvm-project/commit/7e61d893739ff309a1c2e01dee31b1a5e6ed91b8
DIFF: https://github.com/llvm/llvm-project/commit/7e61d893739ff309a1c2e01dee31b1a5e6ed91b8.diff
LOG: [mlir] Apply ClangTidy performance finding
loop variable is copied but only used as const reference
Added:
Modified:
mlir/tools/mlir-rewrite/mlir-rewrite.cpp
Removed:
################################################################################
diff --git a/mlir/tools/mlir-rewrite/mlir-rewrite.cpp b/mlir/tools/mlir-rewrite/mlir-rewrite.cpp
index e70aa5d41aa049..bbb6bd6617a13c 100644
--- a/mlir/tools/mlir-rewrite/mlir-rewrite.cpp
+++ b/mlir/tools/mlir-rewrite/mlir-rewrite.cpp
@@ -38,7 +38,7 @@ SMRange getOpRange(const OperationDefinition &op) {
const char *startOp = op.scopeLoc.Start.getPointer();
const char *endOp = op.scopeLoc.End.getPointer();
- for (auto res : op.resultGroups) {
+ for (const auto &res : op.resultGroups) {
SMRange range = res.definition.loc;
startOp = std::min(startOp, range.Start.getPointer());
}
@@ -317,7 +317,7 @@ static mlir::RewriterRegistration rewriteSimpleRename("simple-rename",
// Rewriter that insert range markers.
LogicalResult markRanges(RewritePad &rewriteState, raw_ostream &os) {
- for (auto it : rewriteState.getOpDefs()) {
+ for (const auto &it : rewriteState.getOpDefs()) {
auto [startOp, endOp] = getOpRange(it);
rewriteState.insertText(startOp, "<");
More information about the Mlir-commits
mailing list