[Mlir-commits] [mlir] 8d8bede - [Bufferization] Avoid repeated hash lookups (NFC) (#108925)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Tue Sep 17 00:18:27 PDT 2024


Author: Kazu Hirata
Date: 2024-09-17T00:18:23-07:00
New Revision: 8d8bedef0d0a6a65927d5684ff332453fb6507ee

URL: https://github.com/llvm/llvm-project/commit/8d8bedef0d0a6a65927d5684ff332453fb6507ee
DIFF: https://github.com/llvm/llvm-project/commit/8d8bedef0d0a6a65927d5684ff332453fb6507ee.diff

LOG: [Bufferization] Avoid repeated hash lookups (NFC) (#108925)

Added: 
    

Modified: 
    mlir/lib/Dialect/Bufferization/Transforms/OneShotAnalysis.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Dialect/Bufferization/Transforms/OneShotAnalysis.cpp b/mlir/lib/Dialect/Bufferization/Transforms/OneShotAnalysis.cpp
index d69c194c55f7d3..829e954d53b259 100644
--- a/mlir/lib/Dialect/Bufferization/Transforms/OneShotAnalysis.cpp
+++ b/mlir/lib/Dialect/Bufferization/Transforms/OneShotAnalysis.cpp
@@ -284,9 +284,8 @@ static bool isReachable(Block *from, Block *to, ArrayRef<Block *> except) {
       continue;
     if (next == to)
       return true;
-    if (visited.contains(next))
+    if (!visited.insert(next).second)
       continue;
-    visited.insert(next);
     for (Block *succ : next->getSuccessors())
       worklist.push_back(succ);
   }


        


More information about the Mlir-commits mailing list