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.