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

llvmlistbot at llvm.org llvmlistbot at llvm.org
Tue Sep 10 20:12:22 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/108140.diff


1 Files Affected:

- (modified) mlir/lib/Interfaces/ValueBoundsOpInterface.cpp (+1-2) 


``````````diff
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.

``````````

</details>


https://github.com/llvm/llvm-project/pull/108140


More information about the Mlir-commits mailing list