Skip to content

Commit cca9ef5

Browse files
committed
[arc] When merging ImmutablePointerSets, since they are uniqued, we can bail early on merging the same set by just performing a pointer equality.
Just a drive by I noticed. Should improve compile time.
1 parent 54b6c2e commit cca9ef5

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

include/swift/Basic/ImmutablePointerSet.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,12 @@ template <typename T> class ImmutablePointerSetFactory {
252252
if (S2->empty())
253253
return S1;
254254

255+
// We know that all of our PtrSets are uniqued. So if S1 and S2 are the same
256+
// set, their pointers must also be the same set. In such a case, we return
257+
// early returning S1 without any loss of generality.
258+
if (S1 == S2)
259+
return S1;
260+
255261
llvm::FoldingSetNodeID ID;
256262

257263
// We know that both of our pointer sets are sorted, so we can essentially

0 commit comments

Comments
 (0)