[Mlir-commits] [mlir] [mlir] Avoid repeated hash lookups (NFC) (PR #113249)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Mon Oct 21 19:14:13 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-mlir
Author: Kazu Hirata (kazutakahirata)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/113249.diff
1 Files Affected:
- (modified) mlir/lib/Pass/IRPrinting.cpp (+1-4)
``````````diff
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 =
``````````
</details>
https://github.com/llvm/llvm-project/pull/113249
More information about the Mlir-commits
mailing list