summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/SmallPtrSet.cpp
diff options
context:
space:
mode:
authorPhilip Reames <listmail@philipreames.com>2016-12-31 02:33:22 +0000
committerPhilip Reames <listmail@philipreames.com>2016-12-31 02:33:22 +0000
commit0ef5d288b4db7baec923ce3707678d036bebf48d (patch)
tree01772a7c354f3dea510d9efd0723597d16fd95a1 /llvm/lib/Support/SmallPtrSet.cpp
parent97cf837b465e9e95fc31368f02ca20036811efba (diff)
downloadbcm5719-llvm-0ef5d288b4db7baec923ce3707678d036bebf48d.tar.gz
bcm5719-llvm-0ef5d288b4db7baec923ce3707678d036bebf48d.zip
[SmallPtrSet] Introduce a find primitive and rewrite count/erase in terms of it
This was originally motivated by a compile time problem I've since figured out how to solve differently, but the cleanup seemed useful. We had the same logic - which essentially implemented find - in several places. By commoning them out, I can implement find and allow erase to be inlined at the call sites if profitable. Differential Revision: https://reviews.llvm.org/D28183 llvm-svn: 290779
Diffstat (limited to 'llvm/lib/Support/SmallPtrSet.cpp')
-rw-r--r--llvm/lib/Support/SmallPtrSet.cpp25
1 files changed, 0 insertions, 25 deletions
diff --git a/llvm/lib/Support/SmallPtrSet.cpp b/llvm/lib/Support/SmallPtrSet.cpp
index 8fb12ba917b..aa12e85fa4c 100644
--- a/llvm/lib/Support/SmallPtrSet.cpp
+++ b/llvm/lib/Support/SmallPtrSet.cpp
@@ -61,31 +61,6 @@ SmallPtrSetImplBase::insert_imp_big(const void *Ptr) {
return std::make_pair(Bucket, true);
}
-bool SmallPtrSetImplBase::erase_imp(const void * Ptr) {
- if (isSmall()) {
- // Check to see if it is in the set.
- for (const void **APtr = CurArray, **E = CurArray + NumNonEmpty; APtr != E;
- ++APtr)
- if (*APtr == Ptr) {
- // If it is in the set, replace this element.
- *APtr = getTombstoneMarker();
- ++NumTombstones;
- return true;
- }
-
- return false;
- }
-
- // Okay, we know we have space. Find a hash bucket.
- void **Bucket = const_cast<void**>(FindBucketFor(Ptr));
- if (*Bucket != Ptr) return false; // Not in the set?
-
- // Set this as a tombstone.
- *Bucket = getTombstoneMarker();
- ++NumTombstones;
- return true;
-}
-
const void * const *SmallPtrSetImplBase::FindBucketFor(const void *Ptr) const {
unsigned Bucket = DenseMapInfo<void *>::getHashValue(Ptr) & (CurArraySize-1);
unsigned ArraySize = CurArraySize;
OpenPOWER on IntegriCloud