mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-14 11:32:34 +00:00
Optimize empty DenseMap iteration.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103962 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
2997985b4c
commit
b843d9f833
@ -79,13 +79,14 @@ public:
|
||||
typedef DenseMapIterator<KeyT, ValueT,
|
||||
KeyInfoT, ValueInfoT, true> const_iterator;
|
||||
inline iterator begin() {
|
||||
return iterator(Buckets, Buckets+NumBuckets);
|
||||
// When the map is empty, avoid the overhead of AdvancePastEmptyBuckets().
|
||||
return empty() ? end() : iterator(Buckets, Buckets+NumBuckets);
|
||||
}
|
||||
inline iterator end() {
|
||||
return iterator(Buckets+NumBuckets, Buckets+NumBuckets);
|
||||
}
|
||||
inline const_iterator begin() const {
|
||||
return const_iterator(Buckets, Buckets+NumBuckets);
|
||||
return empty() ? end() : const_iterator(Buckets, Buckets+NumBuckets);
|
||||
}
|
||||
inline const_iterator end() const {
|
||||
return const_iterator(Buckets+NumBuckets, Buckets+NumBuckets);
|
||||
|
Loading…
Reference in New Issue
Block a user