aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKazu Hirata <kazu@google.com>2024-10-16 06:40:48 -0700
committerGitHub <noreply@github.com>2024-10-16 06:40:48 -0700
commit0a20ab908ca7cc82a4c206d39d0eaf86a46e1ff0 (patch)
tree58bc88780cd32ac29fbba34ce8be826bb4d3407e
parent3a56b03ef33a7462f8e21ed295e59b7d851f85fa (diff)
downloadllvm-0a20ab908ca7cc82a4c206d39d0eaf86a46e1ff0.zip
llvm-0a20ab908ca7cc82a4c206d39d0eaf86a46e1ff0.tar.gz
llvm-0a20ab908ca7cc82a4c206d39d0eaf86a46e1ff0.tar.bz2
[mlir] Avoid repeated hash lookups (NFC) (#112472)
-rw-r--r--mlir/lib/Dialect/MLProgram/Transforms/PipelineGlobalOps.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/mlir/lib/Dialect/MLProgram/Transforms/PipelineGlobalOps.cpp b/mlir/lib/Dialect/MLProgram/Transforms/PipelineGlobalOps.cpp
index 40c83487..27e89d6 100644
--- a/mlir/lib/Dialect/MLProgram/Transforms/PipelineGlobalOps.cpp
+++ b/mlir/lib/Dialect/MLProgram/Transforms/PipelineGlobalOps.cpp
@@ -148,8 +148,9 @@ void MLProgramPipelineGlobals::processBlock(
if (auto store = mlir::dyn_cast<GlobalStoreOp>(op)) {
auto ref = store.getGlobal();
symbolStore.insert(ref);
- if (previousStores.contains(ref)) {
- toDelete.push_back(previousStores.find(ref)->getSecond());
+ auto it = previousStores.find(ref);
+ if (it != previousStores.end()) {
+ toDelete.push_back(it->getSecond());
}
previousLoads[ref] = store.getValue();