Skip to content

Commit 6198cbf

Browse files
teresajohnsonyuxuanchen1997
authored andcommitted
Revert "[ADT] Make set_subtract more efficient when subtrahend is larger (NFC)" (#99386)
Summary: Reverts #98702 This broke some mlir code and needs investigation. Test Plan: Reviewers: Subscribers: Tasks: Tags: Differential Revision: https://phabricator.intern.facebook.com/D60250971
1 parent 134b180 commit 6198cbf

File tree

1 file changed

+0
-15
lines changed

1 file changed

+0
-15
lines changed

llvm/include/llvm/ADT/SetOperations.h

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -94,22 +94,7 @@ S1Ty set_difference(const S1Ty &S1, const S2Ty &S2) {
9494

9595
/// set_subtract(A, B) - Compute A := A - B
9696
///
97-
/// Selects the set to iterate based on the relative sizes of A and B for better
98-
/// efficiency.
99-
///
10097
template <class S1Ty, class S2Ty> void set_subtract(S1Ty &S1, const S2Ty &S2) {
101-
using ElemTy = decltype(*S1.begin());
102-
// A couple callers pass a vector for S2, which doesn't support contains(),
103-
// and wouldn't be efficient if it did.
104-
if constexpr (detail::HasMemberContains<S2Ty, ElemTy>) {
105-
if (S1.size() < S2.size()) {
106-
for (typename S1Ty::iterator SI = S1.begin(), SE = S1.end(); SI != SE;
107-
++SI)
108-
if (S2.contains(*SI))
109-
S1.erase(SI);
110-
return;
111-
}
112-
}
11398
for (typename S2Ty::const_iterator SI = S2.begin(), SE = S2.end(); SI != SE;
11499
++SI)
115100
S1.erase(*SI);

0 commit comments

Comments
 (0)