[Mlir-commits] [mlir] [Interfaces] Avoid repeated hash lookups (NFC) (PR #108140)
Kazu Hirata
llvmlistbot at llvm.org
Tue Sep 10 20:11:47 PDT 2024
https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/108140
None
>From 7627f018a5600bd3060520690ee873bf26a7aa18 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Tue, 10 Sep 2024 07:46:26 -0700
Subject: [PATCH] [Interfaces] Avoid repeated hash lookups (NFC)
---
mlir/lib/Interfaces/ValueBoundsOpInterface.cpp | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
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