From 7627f018a5600bd3060520690ee873bf26a7aa18 Mon Sep 17 00:00:00 2001 From: Kazu Hirata 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 6420c192b257d..505e84e3ca0cf 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.