[Mlir-commits] [mlir] 6ffa7cd - [Interfaces] Avoid repeated hash lookups (NFC) (#108140)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Wed Sep 11 06:40:41 PDT 2024


Author: Kazu Hirata
Date: 2024-09-11T06:40:37-07:00
New Revision: 6ffa7cd8b04ab4b771925d329d7ee8788a3b00ca

URL: https://github.com/llvm/llvm-project/commit/6ffa7cd8b04ab4b771925d329d7ee8788a3b00ca
DIFF: https://github.com/llvm/llvm-project/commit/6ffa7cd8b04ab4b771925d329d7ee8788a3b00ca.diff

LOG: [Interfaces] Avoid repeated hash lookups (NFC) (#108140)

Added: 
    

Modified: 
    mlir/lib/Interfaces/ValueBoundsOpInterface.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Interfaces/ValueBoundsOpInterface.cpp b/mlir/lib/Interfaces/ValueBoundsOpInterface.cpp
index 6420c192b257d4..505e84e3ca0cf3 100644
--- a/mlir/lib/Interfaces/ValueBoundsOpInterface.cpp
+++ b/mlir/lib/Interfaces/ValueBoundsOpInterface.cpp
@@ -605,9 +605,8 @@ LogicalResult ValueBoundsConstraintSet::computeIndependentBound(
     worklist.push_back(v);
     while (!worklist.empty()) {
       Value next = worklist.pop_back_val();
-      if (visited.contains(next))
+      if (!visited.insert(next).second)
         continue;
-      visited.insert(next);
       if (llvm::is_contained(independencies, next))
         return false;
       // TODO: DominanceInfo could be used to stop the traversal early.


        


More information about the Mlir-commits mailing list