[Mlir-commits] [mlir] 0a20ab9 - [mlir] Avoid repeated hash lookups (NFC) (#112472)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Wed Oct 16 06:40:52 PDT 2024


Author: Kazu Hirata
Date: 2024-10-16T06:40:48-07:00
New Revision: 0a20ab908ca7cc82a4c206d39d0eaf86a46e1ff0

URL: https://github.com/llvm/llvm-project/commit/0a20ab908ca7cc82a4c206d39d0eaf86a46e1ff0
DIFF: https://github.com/llvm/llvm-project/commit/0a20ab908ca7cc82a4c206d39d0eaf86a46e1ff0.diff

LOG: [mlir] Avoid repeated hash lookups (NFC) (#112472)

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 40c83487fd47d5..27e89d69e214d6 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();


        


More information about the Mlir-commits mailing list