[Mlir-commits] [mlir] [MLProgram] Avoid repeated hash lookups (NFC) (PR #108928)
Kazu Hirata
llvmlistbot at llvm.org
Mon Sep 16 21:28:19 PDT 2024
https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/108928
None
>From 316a39a065e9d78e9d71f66059540f226e64fb6c Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Mon, 16 Sep 2024 06:52:02 -0700
Subject: [PATCH] [MLProgram] Avoid repeated hash lookups (NFC)
---
mlir/lib/Dialect/MLProgram/Transforms/PipelineGlobalOps.cpp | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/mlir/lib/Dialect/MLProgram/Transforms/PipelineGlobalOps.cpp b/mlir/lib/Dialect/MLProgram/Transforms/PipelineGlobalOps.cpp
index bc7fce95b86a24..40c83487fd47d5 100644
--- a/mlir/lib/Dialect/MLProgram/Transforms/PipelineGlobalOps.cpp
+++ b/mlir/lib/Dialect/MLProgram/Transforms/PipelineGlobalOps.cpp
@@ -100,10 +100,8 @@ LogicalResult MLProgramPipelineGlobals::buildGlobalMap(ModuleOp module) {
for (size_t i = 0; i < work.size(); ++i) {
callableMap[work[i]]->walk([&](CallOpInterface call) {
auto symbol = dyn_cast<SymbolRefAttr>(call.getCallableForCallee());
- if (!visited.contains(symbol)) {
- visited.insert(symbol);
+ if (visited.insert(symbol).second)
work.push_back(symbol);
- }
});
for (auto load : opLoadSymbols[work[i]])
More information about the Mlir-commits
mailing list