[Mlir-commits] [mlir] [MLProgram] Avoid repeated hash lookups (NFC) (PR #108928)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Mon Sep 16 21:28:57 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/108928.diff
1 Files Affected:
- (modified) mlir/lib/Dialect/MLProgram/Transforms/PipelineGlobalOps.cpp (+1-3)
``````````diff
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]])
``````````
</details>
https://github.com/llvm/llvm-project/pull/108928
More information about the Mlir-commits
mailing list