[Mlir-commits] [mlir] [Pass] Avoid repeated hash lookups (NFC) (PR #107761)
Kazu Hirata
llvmlistbot at llvm.org
Sun Sep 8 08:15:00 PDT 2024
https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/107761
None
>From a7a0e322344ab944bf24420edebb1ddb7b7c0fad Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Sun, 8 Sep 2024 07:47:27 -0700
Subject: [PATCH] [Pass] Avoid repeated hash lookups (NFC)
---
mlir/lib/Pass/Pass.cpp | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/mlir/lib/Pass/Pass.cpp b/mlir/lib/Pass/Pass.cpp
index 57a6c20141d2c1..deca03ae137f4e 100644
--- a/mlir/lib/Pass/Pass.cpp
+++ b/mlir/lib/Pass/Pass.cpp
@@ -938,11 +938,9 @@ AnalysisManager AnalysisManager::nestImmediate(Operation *op) {
assert(impl->getOperation() == op->getParentOp() &&
"expected immediate child operation");
- auto it = impl->childAnalyses.find(op);
- if (it == impl->childAnalyses.end())
- it = impl->childAnalyses
- .try_emplace(op, std::make_unique<NestedAnalysisMap>(op, impl))
- .first;
+ auto [it, inserted] = impl->childAnalyses.try_emplace(op);
+ if (inserted)
+ it->second = std::make_unique<NestedAnalysisMap>(op, impl);
return {it->second.get()};
}
More information about the Mlir-commits
mailing list