[Mlir-commits] [mlir] [mlir] Avoid repeated hash lookups (NFC) (PR #113249)
Kazu Hirata
llvmlistbot at llvm.org
Mon Oct 21 19:13:38 PDT 2024
https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/113249
None
>From db82968a4715208d3a62ec8cbaecab820a6ded4c Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Mon, 21 Oct 2024 07:28:24 -0700
Subject: [PATCH] [mlir] Avoid repeated hash lookups (NFC)
---
mlir/lib/Pass/IRPrinting.cpp | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/mlir/lib/Pass/IRPrinting.cpp b/mlir/lib/Pass/IRPrinting.cpp
index 9ffda6402cc07a..99e0601e4749cc 100644
--- a/mlir/lib/Pass/IRPrinting.cpp
+++ b/mlir/lib/Pass/IRPrinting.cpp
@@ -216,11 +216,8 @@ getOpAndSymbolNames(Operation *op, StringRef passName,
SmallVector<std::pair<std::string, StringRef>> pathElements;
SmallVector<unsigned> countPrefix;
- if (!counters.contains(op))
- counters[op] = -1;
-
Operation *iter = op;
- ++counters[op];
+ ++counters.try_emplace(op, -1).first->second;
while (iter) {
countPrefix.push_back(counters[iter]);
StringAttr symbolName =
More information about the Mlir-commits
mailing list