Coverage Report

Created: 2018-07-12 09:57

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/include/llvm/ADT/SparseSet.h
Line
Count
Source (jump to first uncovered line)
1
//===- llvm/ADT/SparseSet.h - Sparse set ------------------------*- C++ -*-===//
2
//
3
//                     The LLVM Compiler Infrastructure
4
//
5
// This file is distributed under the University of Illinois Open Source
6
// License. See LICENSE.TXT for details.
7
//
8
//===----------------------------------------------------------------------===//
9
//
10
// This file defines the SparseSet class derived from the version described in
11
// Briggs, Torczon, "An efficient representation for sparse sets", ACM Letters
12
// on Programming Languages and Systems, Volume 2 Issue 1-4, March-Dec.  1993.
13
//
14
// A sparse set holds a small number of objects identified by integer keys from
15
// a moderately sized universe. The sparse set uses more memory than other
16
// containers in order to provide faster operations.
17
//
18
//===----------------------------------------------------------------------===//
19
20
#ifndef LLVM_ADT_SPARSESET_H
21
#define LLVM_ADT_SPARSESET_H
22
23
#include "llvm/ADT/STLExtras.h"
24
#include "llvm/ADT/SmallVector.h"
25
#include "llvm/Support/Allocator.h"
26
#include <cassert>
27
#include <cstdint>
28
#include <cstdlib>
29
#include <limits>
30
#include <utility>
31
32
namespace llvm {
33
34
/// SparseSetValTraits - Objects in a SparseSet are identified by keys that can
35
/// be uniquely converted to a small integer less than the set's universe. This
36
/// class allows the set to hold values that differ from the set's key type as
37
/// long as an index can still be derived from the value. SparseSet never
38
/// directly compares ValueT, only their indices, so it can map keys to
39
/// arbitrary values. SparseSetValTraits computes the index from the value
40
/// object. To compute the index from a key, SparseSet uses a separate
41
/// KeyFunctorT template argument.
42
///
43
/// A simple type declaration, SparseSet<Type>, handles these cases:
44
/// - unsigned key, identity index, identity value
45
/// - unsigned key, identity index, fat value providing getSparseSetIndex()
46
///
47
/// The type declaration SparseSet<Type, UnaryFunction> handles:
48
/// - unsigned key, remapped index, identity value (virtual registers)
49
/// - pointer key, pointer-derived index, identity value (node+ID)
50
/// - pointer key, pointer-derived index, fat value with getSparseSetIndex()
51
///
52
/// Only other, unexpected cases require specializing SparseSetValTraits.
53
///
54
/// For best results, ValueT should not require a destructor.
55
///
56
template<typename ValueT>
57
struct SparseSetValTraits {
58
189M
  static unsigned getValIndex(const ValueT &Val) {
59
189M
    return Val.getSparseSetIndex();
60
189M
  }
llvm::SparseSetValTraits<llvm::LiveRegUnit>::getValIndex(llvm::LiveRegUnit const&)
Line
Count
Source
58
5.71M
  static unsigned getValIndex(const ValueT &Val) {
59
5.71M
    return Val.getSparseSetIndex();
60
5.71M
  }
llvm::SparseSetValTraits<llvm::VReg2SUnit>::getValIndex(llvm::VReg2SUnit const&)
Line
Count
Source
58
18.5M
  static unsigned getValIndex(const ValueT &Val) {
59
18.5M
    return Val.getSparseSetIndex();
60
18.5M
  }
RegAllocFast.cpp:llvm::SparseSetValTraits<(anonymous namespace)::RegAllocFast::LiveReg>::getValIndex((anonymous namespace)::RegAllocFast::LiveReg const&)
Line
Count
Source
58
320k
  static unsigned getValIndex(const ValueT &Val) {
59
320k
    return Val.getSparseSetIndex();
60
320k
  }
llvm::SparseSetValTraits<llvm::LiveRegSet::IndexMaskPair>::getValIndex(llvm::LiveRegSet::IndexMaskPair const&)
Line
Count
Source
58
31.6M
  static unsigned getValIndex(const ValueT &Val) {
59
31.6M
    return Val.getSparseSetIndex();
60
31.6M
  }
llvm::SparseSetValTraits<llvm::SchedDFSImpl::RootData>::getValIndex(llvm::SchedDFSImpl::RootData const&)
Line
Count
Source
58
1.02k
  static unsigned getValIndex(const ValueT &Val) {
59
1.02k
    return Val.getSparseSetIndex();
60
1.02k
  }
llvm::SparseSetValTraits<llvm::PhysRegSUOper>::getValIndex(llvm::PhysRegSUOper const&)
Line
Count
Source
58
102M
  static unsigned getValIndex(const ValueT &Val) {
59
102M
    return Val.getSparseSetIndex();
60
102M
  }
llvm::SparseSetValTraits<llvm::VReg2SUnitOperIdx>::getValIndex(llvm::VReg2SUnitOperIdx const&)
Line
Count
Source
58
31.0M
  static unsigned getValIndex(const ValueT &Val) {
59
31.0M
    return Val.getSparseSetIndex();
60
31.0M
  }
61
};
62
63
/// SparseSetValFunctor - Helper class for selecting SparseSetValTraits. The
64
/// generic implementation handles ValueT classes which either provide
65
/// getSparseSetIndex() or specialize SparseSetValTraits<>.
66
///
67
template<typename KeyT, typename ValueT, typename KeyFunctorT>
68
struct SparseSetValFunctor {
69
189M
  unsigned operator()(const ValueT &Val) const {
70
189M
    return SparseSetValTraits<ValueT>::getValIndex(Val);
71
189M
  }
llvm::SparseSetValFunctor<unsigned int, llvm::LiveRegUnit, llvm::identity<unsigned int> >::operator()(llvm::LiveRegUnit const&) const
Line
Count
Source
69
5.71M
  unsigned operator()(const ValueT &Val) const {
70
5.71M
    return SparseSetValTraits<ValueT>::getValIndex(Val);
71
5.71M
  }
llvm::SparseSetValFunctor<unsigned int, llvm::VReg2SUnit, llvm::VirtReg2IndexFunctor>::operator()(llvm::VReg2SUnit const&) const
Line
Count
Source
69
18.5M
  unsigned operator()(const ValueT &Val) const {
70
18.5M
    return SparseSetValTraits<ValueT>::getValIndex(Val);
71
18.5M
  }
RegAllocFast.cpp:llvm::SparseSetValFunctor<unsigned int, (anonymous namespace)::RegAllocFast::LiveReg, llvm::identity<unsigned int> >::operator()((anonymous namespace)::RegAllocFast::LiveReg const&) const
Line
Count
Source
69
320k
  unsigned operator()(const ValueT &Val) const {
70
320k
    return SparseSetValTraits<ValueT>::getValIndex(Val);
71
320k
  }
llvm::SparseSetValFunctor<unsigned int, llvm::LiveRegSet::IndexMaskPair, llvm::identity<unsigned int> >::operator()(llvm::LiveRegSet::IndexMaskPair const&) const
Line
Count
Source
69
31.6M
  unsigned operator()(const ValueT &Val) const {
70
31.6M
    return SparseSetValTraits<ValueT>::getValIndex(Val);
71
31.6M
  }
llvm::SparseSetValFunctor<unsigned int, llvm::SchedDFSImpl::RootData, llvm::identity<unsigned int> >::operator()(llvm::SchedDFSImpl::RootData const&) const
Line
Count
Source
69
1.02k
  unsigned operator()(const ValueT &Val) const {
70
1.02k
    return SparseSetValTraits<ValueT>::getValIndex(Val);
71
1.02k
  }
llvm::SparseSetValFunctor<unsigned int, llvm::PhysRegSUOper, llvm::identity<unsigned int> >::operator()(llvm::PhysRegSUOper const&) const
Line
Count
Source
69
102M
  unsigned operator()(const ValueT &Val) const {
70
102M
    return SparseSetValTraits<ValueT>::getValIndex(Val);
71
102M
  }
llvm::SparseSetValFunctor<unsigned int, llvm::VReg2SUnitOperIdx, llvm::VirtReg2IndexFunctor>::operator()(llvm::VReg2SUnitOperIdx const&) const
Line
Count
Source
69
31.0M
  unsigned operator()(const ValueT &Val) const {
70
31.0M
    return SparseSetValTraits<ValueT>::getValIndex(Val);
71
31.0M
  }
72
};
73
74
/// SparseSetValFunctor<KeyT, KeyT> - Helper class for the common case of
75
/// identity key/value sets.
76
template<typename KeyT, typename KeyFunctorT>
77
struct SparseSetValFunctor<KeyT, KeyT, KeyFunctorT> {
78
561M
  unsigned operator()(const KeyT &Key) const {
79
561M
    return KeyFunctorT()(Key);
80
561M
  }
llvm::SparseSetValFunctor<unsigned int, unsigned int, llvm::identity<unsigned int> >::operator()(unsigned int const&) const
Line
Count
Source
78
556M
  unsigned operator()(const KeyT &Key) const {
79
556M
    return KeyFunctorT()(Key);
80
556M
  }
llvm::SparseSetValFunctor<unsigned int, unsigned int, llvm::VirtReg2IndexFunctor>::operator()(unsigned int const&) const
Line
Count
Source
78
4.05M
  unsigned operator()(const KeyT &Key) const {
79
4.05M
    return KeyFunctorT()(Key);
80
4.05M
  }
81
};
82
83
/// SparseSet - Fast set implmentation for objects that can be identified by
84
/// small unsigned keys.
85
///
86
/// SparseSet allocates memory proportional to the size of the key universe, so
87
/// it is not recommended for building composite data structures.  It is useful
88
/// for algorithms that require a single set with fast operations.
89
///
90
/// Compared to DenseSet and DenseMap, SparseSet provides constant-time fast
91
/// clear() and iteration as fast as a vector.  The find(), insert(), and
92
/// erase() operations are all constant time, and typically faster than a hash
93
/// table.  The iteration order doesn't depend on numerical key values, it only
94
/// depends on the order of insert() and erase() operations.  When no elements
95
/// have been erased, the iteration order is the insertion order.
96
///
97
/// Compared to BitVector, SparseSet<unsigned> uses 8x-40x more memory, but
98
/// offers constant-time clear() and size() operations as well as fast
99
/// iteration independent on the size of the universe.
100
///
101
/// SparseSet contains a dense vector holding all the objects and a sparse
102
/// array holding indexes into the dense vector.  Most of the memory is used by
103
/// the sparse array which is the size of the key universe.  The SparseT
104
/// template parameter provides a space/speed tradeoff for sets holding many
105
/// elements.
106
///
107
/// When SparseT is uint32_t, find() only touches 2 cache lines, but the sparse
108
/// array uses 4 x Universe bytes.
109
///
110
/// When SparseT is uint8_t (the default), find() touches up to 2+[N/256] cache
111
/// lines, but the sparse array is 4x smaller.  N is the number of elements in
112
/// the set.
113
///
114
/// For sets that may grow to thousands of elements, SparseT should be set to
115
/// uint16_t or uint32_t.
116
///
117
/// @tparam ValueT      The type of objects in the set.
118
/// @tparam KeyFunctorT A functor that computes an unsigned index from KeyT.
119
/// @tparam SparseT     An unsigned integer type. See above.
120
///
121
template<typename ValueT,
122
         typename KeyFunctorT = identity<unsigned>,
123
         typename SparseT = uint8_t>
124
class SparseSet {
125
  static_assert(std::numeric_limits<SparseT>::is_integer &&
126
                !std::numeric_limits<SparseT>::is_signed,
127
                "SparseT must be an unsigned integer type");
128
129
  using KeyT = typename KeyFunctorT::argument_type;
130
  using DenseT = SmallVector<ValueT, 8>;
131
  using size_type = unsigned;
132
  DenseT Dense;
133
  SparseT *Sparse = nullptr;
134
  unsigned Universe = 0;
135
  KeyFunctorT KeyIndexOf;
136
  SparseSetValFunctor<KeyT, ValueT, KeyFunctorT> ValIndexOf;
137
138
public:
139
  using value_type = ValueT;
140
  using reference = ValueT &;
141
  using const_reference = const ValueT &;
142
  using pointer = ValueT *;
143
  using const_pointer = const ValueT *;
144
145
6.47M
  SparseSet() = default;
llvm::SparseSet<unsigned int, llvm::identity<unsigned int>, unsigned char>::SparseSet()
Line
Count
Source
145
1.37M
  SparseSet() = default;
llvm::SparseSet<llvm::LiveRegSet::IndexMaskPair, llvm::identity<unsigned int>, unsigned char>::SparseSet()
Line
Count
Source
145
1.24M
  SparseSet() = default;
llvm::SparseSet<unsigned int, llvm::VirtReg2IndexFunctor, unsigned char>::SparseSet()
Line
Count
Source
145
1.24M
  SparseSet() = default;
llvm::SparseSet<llvm::LiveRegUnit, llvm::identity<unsigned int>, unsigned char>::SparseSet()
Line
Count
Source
145
2.61M
  SparseSet() = default;
RegAllocFast.cpp:llvm::SparseSet<(anonymous namespace)::RegAllocFast::LiveReg, llvm::identity<unsigned int>, unsigned char>::SparseSet()
Line
Count
Source
145
1.56k
  SparseSet() = default;
llvm::SparseSet<llvm::SchedDFSImpl::RootData, llvm::identity<unsigned int>, unsigned char>::SparseSet()
Line
Count
Source
145
10
  SparseSet() = default;
146
  SparseSet(const SparseSet &) = delete;
147
  SparseSet &operator=(const SparseSet &) = delete;
148
6.47M
  ~SparseSet() { free(Sparse); }
llvm::SparseSet<unsigned int, llvm::identity<unsigned int>, unsigned char>::~SparseSet()
Line
Count
Source
148
1.37M
  ~SparseSet() { free(Sparse); }
llvm::SparseSet<unsigned int, llvm::VirtReg2IndexFunctor, unsigned char>::~SparseSet()
Line
Count
Source
148
1.24M
  ~SparseSet() { free(Sparse); }
llvm::SparseSet<llvm::LiveRegSet::IndexMaskPair, llvm::identity<unsigned int>, unsigned char>::~SparseSet()
Line
Count
Source
148
1.24M
  ~SparseSet() { free(Sparse); }
llvm::SparseSet<llvm::LiveRegUnit, llvm::identity<unsigned int>, unsigned char>::~SparseSet()
Line
Count
Source
148
2.61M
  ~SparseSet() { free(Sparse); }
RegAllocFast.cpp:llvm::SparseSet<(anonymous namespace)::RegAllocFast::LiveReg, llvm::identity<unsigned int>, unsigned char>::~SparseSet()
Line
Count
Source
148
1.55k
  ~SparseSet() { free(Sparse); }
llvm::SparseSet<llvm::SchedDFSImpl::RootData, llvm::identity<unsigned int>, unsigned char>::~SparseSet()
Line
Count
Source
148
10
  ~SparseSet() { free(Sparse); }
149
150
  /// setUniverse - Set the universe size which determines the largest key the
151
  /// set can hold.  The universe must be sized before any elements can be
152
  /// added.
153
  ///
154
  /// @param U Universe size. All object keys must be less than U.
155
  ///
156
4.59M
  void setUniverse(unsigned U) {
157
4.59M
    // It's not hard to resize the universe on a non-empty set, but it doesn't
158
4.59M
    // seem like a likely use case, so we can add that code when we need it.
159
4.59M
    assert(empty() && "Can only resize universe on an empty map");
160
4.59M
    // Hysteresis prevents needless reallocations.
161
4.59M
    if (U >= Universe/4 && 
U <= Universe4.57M
)
162
1.21M
      return;
163
3.37M
    free(Sparse);
164
3.37M
    // The Sparse array doesn't actually need to be initialized, so malloc
165
3.37M
    // would be enough here, but that will cause tools like valgrind to
166
3.37M
    // complain about branching on uninitialized data.
167
3.37M
    Sparse = static_cast<SparseT*>(safe_calloc(U, sizeof(SparseT)));
168
3.37M
    Universe = U;
169
3.37M
  }
llvm::SparseSet<unsigned int, llvm::identity<unsigned int>, unsigned char>::setUniverse(unsigned int)
Line
Count
Source
156
1.40M
  void setUniverse(unsigned U) {
157
1.40M
    // It's not hard to resize the universe on a non-empty set, but it doesn't
158
1.40M
    // seem like a likely use case, so we can add that code when we need it.
159
1.40M
    assert(empty() && "Can only resize universe on an empty map");
160
1.40M
    // Hysteresis prevents needless reallocations.
161
1.40M
    if (U >= Universe/4 && 
U <= Universe1.38M
)
162
1.02M
      return;
163
380k
    free(Sparse);
164
380k
    // The Sparse array doesn't actually need to be initialized, so malloc
165
380k
    // would be enough here, but that will cause tools like valgrind to
166
380k
    // complain about branching on uninitialized data.
167
380k
    Sparse = static_cast<SparseT*>(safe_calloc(U, sizeof(SparseT)));
168
380k
    Universe = U;
169
380k
  }
llvm::SparseSet<llvm::LiveRegUnit, llvm::identity<unsigned int>, unsigned char>::setUniverse(unsigned int)
Line
Count
Source
156
2.61M
  void setUniverse(unsigned U) {
157
2.61M
    // It's not hard to resize the universe on a non-empty set, but it doesn't
158
2.61M
    // seem like a likely use case, so we can add that code when we need it.
159
2.61M
    assert(empty() && "Can only resize universe on an empty map");
160
2.61M
    // Hysteresis prevents needless reallocations.
161
2.61M
    if (U >= Universe/4 && U <= Universe)
162
0
      return;
163
2.61M
    free(Sparse);
164
2.61M
    // The Sparse array doesn't actually need to be initialized, so malloc
165
2.61M
    // would be enough here, but that will cause tools like valgrind to
166
2.61M
    // complain about branching on uninitialized data.
167
2.61M
    Sparse = static_cast<SparseT*>(safe_calloc(U, sizeof(SparseT)));
168
2.61M
    Universe = U;
169
2.61M
  }
RegAllocFast.cpp:llvm::SparseSet<(anonymous namespace)::RegAllocFast::LiveReg, llvm::identity<unsigned int>, unsigned char>::setUniverse(unsigned int)
Line
Count
Source
156
7.19k
  void setUniverse(unsigned U) {
157
7.19k
    // It's not hard to resize the universe on a non-empty set, but it doesn't
158
7.19k
    // seem like a likely use case, so we can add that code when we need it.
159
7.19k
    assert(empty() && "Can only resize universe on an empty map");
160
7.19k
    // Hysteresis prevents needless reallocations.
161
7.19k
    if (U >= Universe/4 && 
U <= Universe7.03k
)
162
5.00k
      return;
163
2.19k
    free(Sparse);
164
2.19k
    // The Sparse array doesn't actually need to be initialized, so malloc
165
2.19k
    // would be enough here, but that will cause tools like valgrind to
166
2.19k
    // complain about branching on uninitialized data.
167
2.19k
    Sparse = static_cast<SparseT*>(safe_calloc(U, sizeof(SparseT)));
168
2.19k
    Universe = U;
169
2.19k
  }
llvm::SparseSet<llvm::LiveRegSet::IndexMaskPair, llvm::identity<unsigned int>, unsigned char>::setUniverse(unsigned int)
Line
Count
Source
156
420k
  void setUniverse(unsigned U) {
157
420k
    // It's not hard to resize the universe on a non-empty set, but it doesn't
158
420k
    // seem like a likely use case, so we can add that code when we need it.
159
420k
    assert(empty() && "Can only resize universe on an empty map");
160
420k
    // Hysteresis prevents needless reallocations.
161
420k
    if (U >= Universe/4 && U <= Universe)
162
141k
      return;
163
279k
    free(Sparse);
164
279k
    // The Sparse array doesn't actually need to be initialized, so malloc
165
279k
    // would be enough here, but that will cause tools like valgrind to
166
279k
    // complain about branching on uninitialized data.
167
279k
    Sparse = static_cast<SparseT*>(safe_calloc(U, sizeof(SparseT)));
168
279k
    Universe = U;
169
279k
  }
llvm::SparseSet<unsigned int, llvm::VirtReg2IndexFunctor, unsigned char>::setUniverse(unsigned int)
Line
Count
Source
156
140k
  void setUniverse(unsigned U) {
157
140k
    // It's not hard to resize the universe on a non-empty set, but it doesn't
158
140k
    // seem like a likely use case, so we can add that code when we need it.
159
140k
    assert(empty() && "Can only resize universe on an empty map");
160
140k
    // Hysteresis prevents needless reallocations.
161
140k
    if (U >= Universe/4 && U <= Universe)
162
47.2k
      return;
163
93.0k
    free(Sparse);
164
93.0k
    // The Sparse array doesn't actually need to be initialized, so malloc
165
93.0k
    // would be enough here, but that will cause tools like valgrind to
166
93.0k
    // complain about branching on uninitialized data.
167
93.0k
    Sparse = static_cast<SparseT*>(safe_calloc(U, sizeof(SparseT)));
168
93.0k
    Universe = U;
169
93.0k
  }
llvm::SparseSet<llvm::SchedDFSImpl::RootData, llvm::identity<unsigned int>, unsigned char>::setUniverse(unsigned int)
Line
Count
Source
156
10
  void setUniverse(unsigned U) {
157
10
    // It's not hard to resize the universe on a non-empty set, but it doesn't
158
10
    // seem like a likely use case, so we can add that code when we need it.
159
10
    assert(empty() && "Can only resize universe on an empty map");
160
10
    // Hysteresis prevents needless reallocations.
161
10
    if (U >= Universe/4 && U <= Universe)
162
0
      return;
163
10
    free(Sparse);
164
10
    // The Sparse array doesn't actually need to be initialized, so malloc
165
10
    // would be enough here, but that will cause tools like valgrind to
166
10
    // complain about branching on uninitialized data.
167
10
    Sparse = static_cast<SparseT*>(safe_calloc(U, sizeof(SparseT)));
168
10
    Universe = U;
169
10
  }
170
171
  // Import trivial vector stuff from DenseT.
172
  using iterator = typename DenseT::iterator;
173
  using const_iterator = typename DenseT::const_iterator;
174
175
881k
  const_iterator begin() const { return Dense.begin(); }
llvm::SparseSet<unsigned int, llvm::identity<unsigned int>, unsigned char>::begin() const
Line
Count
Source
175
320k
  const_iterator begin() const { return Dense.begin(); }
llvm::SparseSet<llvm::LiveRegSet::IndexMaskPair, llvm::identity<unsigned int>, unsigned char>::begin() const
Line
Count
Source
175
561k
  const_iterator begin() const { return Dense.begin(); }
176
27.4M
  const_iterator end() const { return Dense.end(); }
llvm::SparseSet<unsigned int, llvm::identity<unsigned int>, unsigned char>::end() const
Line
Count
Source
176
13.8M
  const_iterator end() const { return Dense.end(); }
llvm::SparseSet<unsigned int, llvm::VirtReg2IndexFunctor, unsigned char>::end() const
Line
Count
Source
176
545k
  const_iterator end() const { return Dense.end(); }
llvm::SparseSet<llvm::LiveRegSet::IndexMaskPair, llvm::identity<unsigned int>, unsigned char>::end() const
Line
Count
Source
176
13.0M
  const_iterator end() const { return Dense.end(); }
llvm::SparseSet<llvm::SchedDFSImpl::RootData, llvm::identity<unsigned int>, unsigned char>::end() const
Line
Count
Source
176
146
  const_iterator end() const { return Dense.end(); }
177
175M
  iterator begin() { return Dense.begin(); }
llvm::SparseSet<unsigned int, llvm::identity<unsigned int>, unsigned char>::begin()
Line
Count
Source
177
159M
  iterator begin() { return Dense.begin(); }
llvm::SparseSet<llvm::LiveRegUnit, llvm::identity<unsigned int>, unsigned char>::begin()
Line
Count
Source
177
3.03M
  iterator begin() { return Dense.begin(); }
RegAllocFast.cpp:llvm::SparseSet<(anonymous namespace)::RegAllocFast::LiveReg, llvm::identity<unsigned int>, unsigned char>::begin()
Line
Count
Source
177
172k
  iterator begin() { return Dense.begin(); }
llvm::SparseSet<unsigned int, llvm::VirtReg2IndexFunctor, unsigned char>::begin()
Line
Count
Source
177
437k
  iterator begin() { return Dense.begin(); }
llvm::SparseSet<llvm::LiveRegSet::IndexMaskPair, llvm::identity<unsigned int>, unsigned char>::begin()
Line
Count
Source
177
12.8M
  iterator begin() { return Dense.begin(); }
llvm::SparseSet<llvm::SchedDFSImpl::RootData, llvm::identity<unsigned int>, unsigned char>::begin()
Line
Count
Source
177
520
  iterator begin() { return Dense.begin(); }
178
829M
  iterator end() { return Dense.end(); }
llvm::SparseSet<unsigned int, llvm::identity<unsigned int>, unsigned char>::end()
Line
Count
Source
178
785M
  iterator end() { return Dense.end(); }
llvm::SparseSet<llvm::LiveRegUnit, llvm::identity<unsigned int>, unsigned char>::end()
Line
Count
Source
178
9.47M
  iterator end() { return Dense.end(); }
RegAllocFast.cpp:llvm::SparseSet<(anonymous namespace)::RegAllocFast::LiveReg, llvm::identity<unsigned int>, unsigned char>::end()
Line
Count
Source
178
292k
  iterator end() { return Dense.end(); }
llvm::SparseSet<unsigned int, llvm::VirtReg2IndexFunctor, unsigned char>::end()
Line
Count
Source
178
5.28M
  iterator end() { return Dense.end(); }
llvm::SparseSet<llvm::LiveRegSet::IndexMaskPair, llvm::identity<unsigned int>, unsigned char>::end()
Line
Count
Source
178
28.7M
  iterator end() { return Dense.end(); }
llvm::SparseSet<llvm::SchedDFSImpl::RootData, llvm::identity<unsigned int>, unsigned char>::end()
Line
Count
Source
178
1.00k
  iterator end() { return Dense.end(); }
179
180
  /// empty - Returns true if the set is empty.
181
  ///
182
  /// This is not the same as BitVector::empty().
183
  ///
184
108M
  bool empty() const { return Dense.empty(); }
llvm::SparseSet<unsigned int, llvm::identity<unsigned int>, unsigned char>::empty() const
Line
Count
Source
184
108M
  bool empty() const { return Dense.empty(); }
RegAllocFast.cpp:llvm::SparseSet<(anonymous namespace)::RegAllocFast::LiveReg, llvm::identity<unsigned int>, unsigned char>::empty() const
Line
Count
Source
184
12.7k
  bool empty() const { return Dense.empty(); }
185
186
  /// size - Returns the number of elements in the set.
187
  ///
188
  /// This is not the same as BitVector::size() which returns the size of the
189
  /// universe.
190
  ///
191
578M
  size_type size() const { return Dense.size(); }
llvm::SparseSet<unsigned int, llvm::identity<unsigned int>, unsigned char>::size() const
Line
Count
Source
191
537M
  size_type size() const { return Dense.size(); }
llvm::SparseSet<llvm::LiveRegUnit, llvm::identity<unsigned int>, unsigned char>::size() const
Line
Count
Source
191
5.99M
  size_type size() const { return Dense.size(); }
RegAllocFast.cpp:llvm::SparseSet<(anonymous namespace)::RegAllocFast::LiveReg, llvm::identity<unsigned int>, unsigned char>::size() const
Line
Count
Source
191
265k
  size_type size() const { return Dense.size(); }
llvm::SparseSet<llvm::LiveRegSet::IndexMaskPair, llvm::identity<unsigned int>, unsigned char>::size() const
Line
Count
Source
191
30.0M
  size_type size() const { return Dense.size(); }
llvm::SparseSet<unsigned int, llvm::VirtReg2IndexFunctor, unsigned char>::size() const
Line
Count
Source
191
3.97M
  size_type size() const { return Dense.size(); }
llvm::SparseSet<llvm::SchedDFSImpl::RootData, llvm::identity<unsigned int>, unsigned char>::size() const
Line
Count
Source
191
814
  size_type size() const { return Dense.size(); }
192
193
  /// clear - Clears the set.  This is a very fast constant time operation.
194
  ///
195
15.8M
  void clear() {
196
15.8M
    // Sparse does not need to be cleared, see find().
197
15.8M
    Dense.clear();
198
15.8M
  }
llvm::SparseSet<unsigned int, llvm::identity<unsigned int>, unsigned char>::clear()
Line
Count
Source
195
10.0M
  void clear() {
196
10.0M
    // Sparse does not need to be cleared, see find().
197
10.0M
    Dense.clear();
198
10.0M
  }
RegAllocFast.cpp:llvm::SparseSet<(anonymous namespace)::RegAllocFast::LiveReg, llvm::identity<unsigned int>, unsigned char>::clear()
Line
Count
Source
195
4.43k
  void clear() {
196
4.43k
    // Sparse does not need to be cleared, see find().
197
4.43k
    Dense.clear();
198
4.43k
  }
llvm::SparseSet<llvm::LiveRegSet::IndexMaskPair, llvm::identity<unsigned int>, unsigned char>::clear()
Line
Count
Source
195
2.90M
  void clear() {
196
2.90M
    // Sparse does not need to be cleared, see find().
197
2.90M
    Dense.clear();
198
2.90M
  }
llvm::SparseSet<unsigned int, llvm::VirtReg2IndexFunctor, unsigned char>::clear()
Line
Count
Source
195
2.90M
  void clear() {
196
2.90M
    // Sparse does not need to be cleared, see find().
197
2.90M
    Dense.clear();
198
2.90M
  }
199
200
  /// findIndex - Find an element by its index.
201
  ///
202
  /// @param   Idx A valid index to find.
203
  /// @returns An iterator to the element identified by key, or end().
204
  ///
205
396M
  iterator findIndex(unsigned Idx) {
206
396M
    assert(Idx < Universe && "Key out of range");
207
396M
    const unsigned Stride = std::numeric_limits<SparseT>::max() + 1u;
208
523M
    for (unsigned i = Sparse[Idx], e = size(); i < e; 
i += Stride126M
) {
209
280M
      const unsigned FoundIdx = ValIndexOf(Dense[i]);
210
280M
      assert(FoundIdx < Universe && "Invalid key in set. Did object mutate?");
211
280M
      if (Idx == FoundIdx)
212
154M
        return begin() + i;
213
126M
      // Stride is 0 when SparseT >= unsigned.  We don't need to loop.
214
126M
      if (!Stride)
215
0
        break;
216
126M
    }
217
396M
    
return end()242M
;
218
396M
  }
llvm::SparseSet<unsigned int, llvm::identity<unsigned int>, unsigned char>::findIndex(unsigned int)
Line
Count
Source
205
364M
  iterator findIndex(unsigned Idx) {
206
364M
    assert(Idx < Universe && "Key out of range");
207
364M
    const unsigned Stride = std::numeric_limits<SparseT>::max() + 1u;
208
477M
    for (unsigned i = Sparse[Idx], e = size(); i < e; 
i += Stride112M
) {
209
250M
      const unsigned FoundIdx = ValIndexOf(Dense[i]);
210
250M
      assert(FoundIdx < Universe && "Invalid key in set. Did object mutate?");
211
250M
      if (Idx == FoundIdx)
212
138M
        return begin() + i;
213
112M
      // Stride is 0 when SparseT >= unsigned.  We don't need to loop.
214
112M
      if (!Stride)
215
0
        break;
216
112M
    }
217
364M
    
return end()226M
;
218
364M
  }
llvm::SparseSet<llvm::LiveRegUnit, llvm::identity<unsigned int>, unsigned char>::findIndex(unsigned int)
Line
Count
Source
205
4.65M
  iterator findIndex(unsigned Idx) {
206
4.65M
    assert(Idx < Universe && "Key out of range");
207
4.65M
    const unsigned Stride = std::numeric_limits<SparseT>::max() + 1u;
208
5.67M
    for (unsigned i = Sparse[Idx], e = size(); i < e; 
i += Stride1.02M
) {
209
3.49M
      const unsigned FoundIdx = ValIndexOf(Dense[i]);
210
3.49M
      assert(FoundIdx < Universe && "Invalid key in set. Did object mutate?");
211
3.49M
      if (Idx == FoundIdx)
212
2.46M
        return begin() + i;
213
1.02M
      // Stride is 0 when SparseT >= unsigned.  We don't need to loop.
214
1.02M
      if (!Stride)
215
0
        break;
216
1.02M
    }
217
4.65M
    
return end()2.18M
;
218
4.65M
  }
RegAllocFast.cpp:llvm::SparseSet<(anonymous namespace)::RegAllocFast::LiveReg, llvm::identity<unsigned int>, unsigned char>::findIndex(unsigned int)
Line
Count
Source
205
206k
  iterator findIndex(unsigned Idx) {
206
206k
    assert(Idx < Universe && "Key out of range");
207
206k
    const unsigned Stride = std::numeric_limits<SparseT>::max() + 1u;
208
238k
    for (unsigned i = Sparse[Idx], e = size(); i < e; 
i += Stride31.5k
) {
209
180k
      const unsigned FoundIdx = ValIndexOf(Dense[i]);
210
180k
      assert(FoundIdx < Universe && "Invalid key in set. Did object mutate?");
211
180k
      if (Idx == FoundIdx)
212
148k
        return begin() + i;
213
31.5k
      // Stride is 0 when SparseT >= unsigned.  We don't need to loop.
214
31.5k
      if (!Stride)
215
0
        break;
216
31.5k
    }
217
206k
    
return end()58.3k
;
218
206k
  }
llvm::SparseSet<unsigned int, llvm::VirtReg2IndexFunctor, unsigned char>::findIndex(unsigned int)
Line
Count
Source
205
2.29M
  iterator findIndex(unsigned Idx) {
206
2.29M
    assert(Idx < Universe && "Key out of range");
207
2.29M
    const unsigned Stride = std::numeric_limits<SparseT>::max() + 1u;
208
4.16M
    for (unsigned i = Sparse[Idx], e = size(); i < e; 
i += Stride1.87M
) {
209
2.30M
      const unsigned FoundIdx = ValIndexOf(Dense[i]);
210
2.30M
      assert(FoundIdx < Universe && "Invalid key in set. Did object mutate?");
211
2.30M
      if (Idx == FoundIdx)
212
437k
        return begin() + i;
213
1.87M
      // Stride is 0 when SparseT >= unsigned.  We don't need to loop.
214
1.87M
      if (!Stride)
215
0
        break;
216
1.87M
    }
217
2.29M
    
return end()1.85M
;
218
2.29M
  }
llvm::SparseSet<llvm::LiveRegSet::IndexMaskPair, llvm::identity<unsigned int>, unsigned char>::findIndex(unsigned int)
Line
Count
Source
205
24.6M
  iterator findIndex(unsigned Idx) {
206
24.6M
    assert(Idx < Universe && "Key out of range");
207
24.6M
    const unsigned Stride = std::numeric_limits<SparseT>::max() + 1u;
208
35.6M
    for (unsigned i = Sparse[Idx], e = size(); i < e; 
i += Stride11.0M
) {
209
23.8M
      const unsigned FoundIdx = ValIndexOf(Dense[i]);
210
23.8M
      assert(FoundIdx < Universe && "Invalid key in set. Did object mutate?");
211
23.8M
      if (Idx == FoundIdx)
212
12.8M
        return begin() + i;
213
11.0M
      // Stride is 0 when SparseT >= unsigned.  We don't need to loop.
214
11.0M
      if (!Stride)
215
0
        break;
216
11.0M
    }
217
24.6M
    
return end()11.8M
;
218
24.6M
  }
llvm::SparseSet<llvm::SchedDFSImpl::RootData, llvm::identity<unsigned int>, unsigned char>::findIndex(unsigned int)
Line
Count
Source
205
638
  iterator findIndex(unsigned Idx) {
206
638
    assert(Idx < Universe && "Key out of range");
207
638
    const unsigned Stride = std::numeric_limits<SparseT>::max() + 1u;
208
798
    for (unsigned i = Sparse[Idx], e = size(); i < e; 
i += Stride160
) {
209
614
      const unsigned FoundIdx = ValIndexOf(Dense[i]);
210
614
      assert(FoundIdx < Universe && "Invalid key in set. Did object mutate?");
211
614
      if (Idx == FoundIdx)
212
454
        return begin() + i;
213
160
      // Stride is 0 when SparseT >= unsigned.  We don't need to loop.
214
160
      if (!Stride)
215
0
        break;
216
160
    }
217
638
    
return end()184
;
218
638
  }
219
220
  /// find - Find an element by its key.
221
  ///
222
  /// @param   Key A valid key to find.
223
  /// @returns An iterator to the element identified by key, or end().
224
  ///
225
72.7M
  iterator find(const KeyT &Key) {
226
72.7M
    return findIndex(KeyIndexOf(Key));
227
72.7M
  }
llvm::SparseSet<unsigned int, llvm::identity<unsigned int>, unsigned char>::find(unsigned int const&)
Line
Count
Source
225
65.8M
  iterator find(const KeyT &Key) {
226
65.8M
    return findIndex(KeyIndexOf(Key));
227
65.8M
  }
llvm::SparseSet<llvm::LiveRegUnit, llvm::identity<unsigned int>, unsigned char>::find(unsigned int const&)
Line
Count
Source
225
2.55M
  iterator find(const KeyT &Key) {
226
2.55M
    return findIndex(KeyIndexOf(Key));
227
2.55M
  }
RegAllocFast.cpp:llvm::SparseSet<(anonymous namespace)::RegAllocFast::LiveReg, llvm::identity<unsigned int>, unsigned char>::find(unsigned int const&)
Line
Count
Source
225
32.4k
  iterator find(const KeyT &Key) {
226
32.4k
    return findIndex(KeyIndexOf(Key));
227
32.4k
  }
llvm::SparseSet<llvm::LiveRegSet::IndexMaskPair, llvm::identity<unsigned int>, unsigned char>::find(unsigned int const&)
Line
Count
Source
225
4.26M
  iterator find(const KeyT &Key) {
226
4.26M
    return findIndex(KeyIndexOf(Key));
227
4.26M
  }
llvm::SparseSet<llvm::SchedDFSImpl::RootData, llvm::identity<unsigned int>, unsigned char>::find(unsigned int const&)
Line
Count
Source
225
138
  iterator find(const KeyT &Key) {
226
138
    return findIndex(KeyIndexOf(Key));
227
138
  }
228
229
26.6M
  const_iterator find(const KeyT &Key) const {
230
26.6M
    return const_cast<SparseSet*>(this)->findIndex(KeyIndexOf(Key));
231
26.6M
  }
llvm::SparseSet<unsigned int, llvm::identity<unsigned int>, unsigned char>::find(unsigned int const&) const
Line
Count
Source
229
13.5M
  const_iterator find(const KeyT &Key) const {
230
13.5M
    return const_cast<SparseSet*>(this)->findIndex(KeyIndexOf(Key));
231
13.5M
  }
RegAllocFast.cpp:llvm::SparseSet<(anonymous namespace)::RegAllocFast::LiveReg, llvm::identity<unsigned int>, unsigned char>::find(unsigned int const&) const
Line
Count
Source
229
53.5k
  const_iterator find(const KeyT &Key) const {
230
53.5k
    return const_cast<SparseSet*>(this)->findIndex(KeyIndexOf(Key));
231
53.5k
  }
llvm::SparseSet<unsigned int, llvm::VirtReg2IndexFunctor, unsigned char>::find(unsigned int const&) const
Line
Count
Source
229
545k
  const_iterator find(const KeyT &Key) const {
230
545k
    return const_cast<SparseSet*>(this)->findIndex(KeyIndexOf(Key));
231
545k
  }
llvm::SparseSet<llvm::LiveRegSet::IndexMaskPair, llvm::identity<unsigned int>, unsigned char>::find(unsigned int const&) const
Line
Count
Source
229
12.5M
  const_iterator find(const KeyT &Key) const {
230
12.5M
    return const_cast<SparseSet*>(this)->findIndex(KeyIndexOf(Key));
231
12.5M
  }
llvm::SparseSet<llvm::SchedDFSImpl::RootData, llvm::identity<unsigned int>, unsigned char>::find(unsigned int const&) const
Line
Count
Source
229
146
  const_iterator find(const KeyT &Key) const {
230
146
    return const_cast<SparseSet*>(this)->findIndex(KeyIndexOf(Key));
231
146
  }
232
233
  /// count - Returns 1 if this set contains an element identified by Key,
234
  /// 0 otherwise.
235
  ///
236
14.0M
  size_type count(const KeyT &Key) const {
237
14.0M
    return find(Key) == end() ? 
010.3M
:
13.70M
;
238
14.0M
  }
llvm::SparseSet<unsigned int, llvm::identity<unsigned int>, unsigned char>::count(unsigned int const&) const
Line
Count
Source
236
13.5M
  size_type count(const KeyT &Key) const {
237
13.5M
    return find(Key) == end() ? 
010.1M
:
13.34M
;
238
13.5M
  }
llvm::SparseSet<unsigned int, llvm::VirtReg2IndexFunctor, unsigned char>::count(unsigned int const&) const
Line
Count
Source
236
545k
  size_type count(const KeyT &Key) const {
237
545k
    return find(Key) == end() ? 
0181k
:
1363k
;
238
545k
  }
llvm::SparseSet<llvm::SchedDFSImpl::RootData, llvm::identity<unsigned int>, unsigned char>::count(unsigned int const&) const
Line
Count
Source
236
146
  size_type count(const KeyT &Key) const {
237
146
    return find(Key) == end() ? 
08
:
1138
;
238
146
  }
239
240
  /// insert - Attempts to insert a new element.
241
  ///
242
  /// If Val is successfully inserted, return (I, true), where I is an iterator
243
  /// pointing to the newly inserted element.
244
  ///
245
  /// If the set already contains an element with the same key as Val, return
246
  /// (I, false), where I is an iterator pointing to the existing element.
247
  ///
248
  /// Insertion invalidates all iterators.
249
  ///
250
297M
  std::pair<iterator, bool> insert(const ValueT &Val) {
251
297M
    unsigned Idx = ValIndexOf(Val);
252
297M
    iterator I = findIndex(Idx);
253
297M
    if (I != end())
254
116M
      return std::make_pair(I, false);
255
180M
    Sparse[Idx] = size();
256
180M
    Dense.push_back(Val);
257
180M
    return std::make_pair(end() - 1, true);
258
180M
  }
llvm::SparseSet<unsigned int, llvm::identity<unsigned int>, unsigned char>::insert(unsigned int const&)
Line
Count
Source
250
285M
  std::pair<iterator, bool> insert(const ValueT &Val) {
251
285M
    unsigned Idx = ValIndexOf(Val);
252
285M
    iterator I = findIndex(Idx);
253
285M
    if (I != end())
254
112M
      return std::make_pair(I, false);
255
172M
    Sparse[Idx] = size();
256
172M
    Dense.push_back(Val);
257
172M
    return std::make_pair(end() - 1, true);
258
172M
  }
llvm::SparseSet<llvm::LiveRegUnit, llvm::identity<unsigned int>, unsigned char>::insert(llvm::LiveRegUnit const&)
Line
Count
Source
250
2.10M
  std::pair<iterator, bool> insert(const ValueT &Val) {
251
2.10M
    unsigned Idx = ValIndexOf(Val);
252
2.10M
    iterator I = findIndex(Idx);
253
2.10M
    if (I != end())
254
764k
      return std::make_pair(I, false);
255
1.33M
    Sparse[Idx] = size();
256
1.33M
    Dense.push_back(Val);
257
1.33M
    return std::make_pair(end() - 1, true);
258
1.33M
  }
RegAllocFast.cpp:llvm::SparseSet<(anonymous namespace)::RegAllocFast::LiveReg, llvm::identity<unsigned int>, unsigned char>::insert((anonymous namespace)::RegAllocFast::LiveReg const&)
Line
Count
Source
250
120k
  std::pair<iterator, bool> insert(const ValueT &Val) {
251
120k
    unsigned Idx = ValIndexOf(Val);
252
120k
    iterator I = findIndex(Idx);
253
120k
    if (I != end())
254
62.4k
      return std::make_pair(I, false);
255
58.3k
    Sparse[Idx] = size();
256
58.3k
    Dense.push_back(Val);
257
58.3k
    return std::make_pair(end() - 1, true);
258
58.3k
  }
llvm::SparseSet<llvm::LiveRegSet::IndexMaskPair, llvm::identity<unsigned int>, unsigned char>::insert(llvm::LiveRegSet::IndexMaskPair const&)
Line
Count
Source
250
7.85M
  std::pair<iterator, bool> insert(const ValueT &Val) {
251
7.85M
    unsigned Idx = ValIndexOf(Val);
252
7.85M
    iterator I = findIndex(Idx);
253
7.85M
    if (I != end())
254
3.02M
      return std::make_pair(I, false);
255
4.83M
    Sparse[Idx] = size();
256
4.83M
    Dense.push_back(Val);
257
4.83M
    return std::make_pair(end() - 1, true);
258
4.83M
  }
llvm::SparseSet<unsigned int, llvm::VirtReg2IndexFunctor, unsigned char>::insert(unsigned int const&)
Line
Count
Source
250
1.75M
  std::pair<iterator, bool> insert(const ValueT &Val) {
251
1.75M
    unsigned Idx = ValIndexOf(Val);
252
1.75M
    iterator I = findIndex(Idx);
253
1.75M
    if (I != end())
254
73.0k
      return std::make_pair(I, false);
255
1.67M
    Sparse[Idx] = size();
256
1.67M
    Dense.push_back(Val);
257
1.67M
    return std::make_pair(end() - 1, true);
258
1.67M
  }
llvm::SparseSet<llvm::SchedDFSImpl::RootData, llvm::identity<unsigned int>, unsigned char>::insert(llvm::SchedDFSImpl::RootData const&)
Line
Count
Source
250
354
  std::pair<iterator, bool> insert(const ValueT &Val) {
251
354
    unsigned Idx = ValIndexOf(Val);
252
354
    iterator I = findIndex(Idx);
253
354
    if (I != end())
254
178
      return std::make_pair(I, false);
255
176
    Sparse[Idx] = size();
256
176
    Dense.push_back(Val);
257
176
    return std::make_pair(end() - 1, true);
258
176
  }
259
260
  /// array subscript - If an element already exists with this key, return it.
261
  /// Otherwise, automatically construct a new value from Key, insert it,
262
  /// and return the newly inserted element.
263
2.10M
  ValueT &operator[](const KeyT &Key) {
264
2.10M
    return *insert(ValueT(Key)).first;
265
2.10M
  }
llvm::SparseSet<llvm::LiveRegUnit, llvm::identity<unsigned int>, unsigned char>::operator[](unsigned int const&)
Line
Count
Source
263
2.10M
  ValueT &operator[](const KeyT &Key) {
264
2.10M
    return *insert(ValueT(Key)).first;
265
2.10M
  }
llvm::SparseSet<llvm::SchedDFSImpl::RootData, llvm::identity<unsigned int>, unsigned char>::operator[](unsigned int const&)
Line
Count
Source
263
354
  ValueT &operator[](const KeyT &Key) {
264
354
    return *insert(ValueT(Key)).first;
265
354
  }
266
267
95.4M
  ValueT pop_back_val() {
268
95.4M
    // Sparse does not need to be cleared, see find().
269
95.4M
    return Dense.pop_back_val();
270
95.4M
  }
271
272
  /// erase - Erases an existing element identified by a valid iterator.
273
  ///
274
  /// This invalidates all iterators, but erase() returns an iterator pointing
275
  /// to the next element.  This makes it possible to erase selected elements
276
  /// while iterating over the set:
277
  ///
278
  ///   for (SparseSet::iterator I = Set.begin(); I != Set.end();)
279
  ///     if (test(*I))
280
  ///       I = Set.erase(I);
281
  ///     else
282
  ///       ++I;
283
  ///
284
  /// Note that end() changes when elements are erased, unlike std::list.
285
  ///
286
24.7M
  iterator erase(iterator I) {
287
24.7M
    assert(unsigned(I - begin()) < size() && "Invalid iterator");
288
24.7M
    if (I != end() - 1) {
289
20.5M
      *I = Dense.back();
290
20.5M
      unsigned BackIdx = ValIndexOf(Dense.back());
291
20.5M
      assert(BackIdx < Universe && "Invalid key in set. Did object mutate?");
292
20.5M
      Sparse[BackIdx] = I - begin();
293
20.5M
    }
294
24.7M
    // This depends on SmallVector::pop_back() not invalidating iterators.
295
24.7M
    // std::vector::pop_back() doesn't give that guarantee.
296
24.7M
    Dense.pop_back();
297
24.7M
    return I;
298
24.7M
  }
llvm::SparseSet<unsigned int, llvm::identity<unsigned int>, unsigned char>::erase(unsigned int*)
Line
Count
Source
286
23.8M
  iterator erase(iterator I) {
287
23.8M
    assert(unsigned(I - begin()) < size() && "Invalid iterator");
288
23.8M
    if (I != end() - 1) {
289
20.3M
      *I = Dense.back();
290
20.3M
      unsigned BackIdx = ValIndexOf(Dense.back());
291
20.3M
      assert(BackIdx < Universe && "Invalid key in set. Did object mutate?");
292
20.3M
      Sparse[BackIdx] = I - begin();
293
20.3M
    }
294
23.8M
    // This depends on SmallVector::pop_back() not invalidating iterators.
295
23.8M
    // std::vector::pop_back() doesn't give that guarantee.
296
23.8M
    Dense.pop_back();
297
23.8M
    return I;
298
23.8M
  }
llvm::SparseSet<llvm::LiveRegUnit, llvm::identity<unsigned int>, unsigned char>::erase(llvm::LiveRegUnit*)
Line
Count
Source
286
838k
  iterator erase(iterator I) {
287
838k
    assert(unsigned(I - begin()) < size() && "Invalid iterator");
288
838k
    if (I != end() - 1) {
289
117k
      *I = Dense.back();
290
117k
      unsigned BackIdx = ValIndexOf(Dense.back());
291
117k
      assert(BackIdx < Universe && "Invalid key in set. Did object mutate?");
292
117k
      Sparse[BackIdx] = I - begin();
293
117k
    }
294
838k
    // This depends on SmallVector::pop_back() not invalidating iterators.
295
838k
    // std::vector::pop_back() doesn't give that guarantee.
296
838k
    Dense.pop_back();
297
838k
    return I;
298
838k
  }
RegAllocFast.cpp:llvm::SparseSet<(anonymous namespace)::RegAllocFast::LiveReg, llvm::identity<unsigned int>, unsigned char>::erase((anonymous namespace)::RegAllocFast::LiveReg*)
Line
Count
Source
286
50.2k
  iterator erase(iterator I) {
287
50.2k
    assert(unsigned(I - begin()) < size() && "Invalid iterator");
288
50.2k
    if (I != end() - 1) {
289
20.0k
      *I = Dense.back();
290
20.0k
      unsigned BackIdx = ValIndexOf(Dense.back());
291
20.0k
      assert(BackIdx < Universe && "Invalid key in set. Did object mutate?");
292
20.0k
      Sparse[BackIdx] = I - begin();
293
20.0k
    }
294
50.2k
    // This depends on SmallVector::pop_back() not invalidating iterators.
295
50.2k
    // std::vector::pop_back() doesn't give that guarantee.
296
50.2k
    Dense.pop_back();
297
50.2k
    return I;
298
50.2k
  }
llvm::SparseSet<llvm::SchedDFSImpl::RootData, llvm::identity<unsigned int>, unsigned char>::erase(llvm::SchedDFSImpl::RootData*)
Line
Count
Source
286
138
  iterator erase(iterator I) {
287
138
    assert(unsigned(I - begin()) < size() && "Invalid iterator");
288
138
    if (I != end() - 1) {
289
56
      *I = Dense.back();
290
56
      unsigned BackIdx = ValIndexOf(Dense.back());
291
56
      assert(BackIdx < Universe && "Invalid key in set. Did object mutate?");
292
56
      Sparse[BackIdx] = I - begin();
293
56
    }
294
138
    // This depends on SmallVector::pop_back() not invalidating iterators.
295
138
    // std::vector::pop_back() doesn't give that guarantee.
296
138
    Dense.pop_back();
297
138
    return I;
298
138
  }
299
300
  /// erase - Erases an element identified by Key, if it exists.
301
  ///
302
  /// @param   Key The key identifying the element to erase.
303
  /// @returns True when an element was erased, false if no element was found.
304
  ///
305
66.0M
  bool erase(const KeyT &Key) {
306
66.0M
    iterator I = find(Key);
307
66.0M
    if (I == end())
308
43.3M
      return false;
309
22.7M
    erase(I);
310
22.7M
    return true;
311
22.7M
  }
llvm::SparseSet<unsigned int, llvm::identity<unsigned int>, unsigned char>::erase(unsigned int const&)
Line
Count
Source
305
65.8M
  bool erase(const KeyT &Key) {
306
65.8M
    iterator I = find(Key);
307
65.8M
    if (I == end())
308
43.2M
      return false;
309
22.6M
    erase(I);
310
22.6M
    return true;
311
22.6M
  }
llvm::SparseSet<llvm::LiveRegUnit, llvm::identity<unsigned int>, unsigned char>::erase(unsigned int const&)
Line
Count
Source
305
206k
  bool erase(const KeyT &Key) {
306
206k
    iterator I = find(Key);
307
206k
    if (I == end())
308
139k
      return false;
309
67.4k
    erase(I);
310
67.4k
    return true;
311
67.4k
  }
llvm::SparseSet<llvm::SchedDFSImpl::RootData, llvm::identity<unsigned int>, unsigned char>::erase(unsigned int const&)
Line
Count
Source
305
138
  bool erase(const KeyT &Key) {
306
138
    iterator I = find(Key);
307
138
    if (I == end())
308
0
      return false;
309
138
    erase(I);
310
138
    return true;
311
138
  }
312
};
313
314
} // end namespace llvm
315
316
#endif // LLVM_ADT_SPARSESET_H