[Mlir-commits] [mlir] 71a39ec - [MLProgram] Avoid repeated hash lookups (NFC) (#108928)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Tue Sep 17 00:19:05 PDT 2024


Author: Kazu Hirata
Date: 2024-09-17T00:19:02-07:00
New Revision: 71a39eca1e1b8eb9fb3da8ff7c86f88a73b1ec47

URL: https://github.com/llvm/llvm-project/commit/71a39eca1e1b8eb9fb3da8ff7c86f88a73b1ec47
DIFF: https://github.com/llvm/llvm-project/commit/71a39eca1e1b8eb9fb3da8ff7c86f88a73b1ec47.diff

LOG: [MLProgram] Avoid repeated hash lookups (NFC) (#108928)

Added: 
    

Modified: 
    mlir/lib/Dialect/MLProgram/Transforms/PipelineGlobalOps.cpp

Removed: 
    


################################################################################
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