[Mlir-commits] [mlir] c5ea7b8 - [mlir] Avoid repeated hash lookups (NFC) (#113249)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Tue Oct 22 08:00:21 PDT 2024
Author: Kazu Hirata
Date: 2024-10-22T08:00:11-07:00
New Revision: c5ea7b8338e6947b5219f95a60702fac1da633ee
URL: https://github.com/llvm/llvm-project/commit/c5ea7b8338e6947b5219f95a60702fac1da633ee
DIFF: https://github.com/llvm/llvm-project/commit/c5ea7b8338e6947b5219f95a60702fac1da633ee.diff
LOG: [mlir] Avoid repeated hash lookups (NFC) (#113249)
Added:
Modified:
mlir/lib/Pass/IRPrinting.cpp
Removed:
################################################################################
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