Coverage Report

Created: 2019-03-24 22:13

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/include/llvm/ADT/IntervalMap.h
Line
Count
Source (jump to first uncovered line)
1
//===- llvm/ADT/IntervalMap.h - A sorted interval map -----------*- C++ -*-===//
2
//
3
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
// See https://llvm.org/LICENSE.txt for license information.
5
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
//
7
//===----------------------------------------------------------------------===//
8
//
9
// This file implements a coalescing interval map for small objects.
10
//
11
// KeyT objects are mapped to ValT objects. Intervals of keys that map to the
12
// same value are represented in a compressed form.
13
//
14
// Iterators provide ordered access to the compressed intervals rather than the
15
// individual keys, and insert and erase operations use key intervals as well.
16
//
17
// Like SmallVector, IntervalMap will store the first N intervals in the map
18
// object itself without any allocations. When space is exhausted it switches to
19
// a B+-tree representation with very small overhead for small key and value
20
// objects.
21
//
22
// A Traits class specifies how keys are compared. It also allows IntervalMap to
23
// work with both closed and half-open intervals.
24
//
25
// Keys and values are not stored next to each other in a std::pair, so we don't
26
// provide such a value_type. Dereferencing iterators only returns the mapped
27
// value. The interval bounds are accessible through the start() and stop()
28
// iterator methods.
29
//
30
// IntervalMap is optimized for small key and value objects, 4 or 8 bytes each
31
// is the optimal size. For large objects use std::map instead.
32
//
33
//===----------------------------------------------------------------------===//
34
//
35
// Synopsis:
36
//
37
// template <typename KeyT, typename ValT, unsigned N, typename Traits>
38
// class IntervalMap {
39
// public:
40
//   typedef KeyT key_type;
41
//   typedef ValT mapped_type;
42
//   typedef RecyclingAllocator<...> Allocator;
43
//   class iterator;
44
//   class const_iterator;
45
//
46
//   explicit IntervalMap(Allocator&);
47
//   ~IntervalMap():
48
//
49
//   bool empty() const;
50
//   KeyT start() const;
51
//   KeyT stop() const;
52
//   ValT lookup(KeyT x, Value NotFound = Value()) const;
53
//
54
//   const_iterator begin() const;
55
//   const_iterator end() const;
56
//   iterator begin();
57
//   iterator end();
58
//   const_iterator find(KeyT x) const;
59
//   iterator find(KeyT x);
60
//
61
//   void insert(KeyT a, KeyT b, ValT y);
62
//   void clear();
63
// };
64
//
65
// template <typename KeyT, typename ValT, unsigned N, typename Traits>
66
// class IntervalMap::const_iterator :
67
//   public std::iterator<std::bidirectional_iterator_tag, ValT> {
68
// public:
69
//   bool operator==(const const_iterator &) const;
70
//   bool operator!=(const const_iterator &) const;
71
//   bool valid() const;
72
//
73
//   const KeyT &start() const;
74
//   const KeyT &stop() const;
75
//   const ValT &value() const;
76
//   const ValT &operator*() const;
77
//   const ValT *operator->() const;
78
//
79
//   const_iterator &operator++();
80
//   const_iterator &operator++(int);
81
//   const_iterator &operator--();
82
//   const_iterator &operator--(int);
83
//   void goToBegin();
84
//   void goToEnd();
85
//   void find(KeyT x);
86
//   void advanceTo(KeyT x);
87
// };
88
//
89
// template <typename KeyT, typename ValT, unsigned N, typename Traits>
90
// class IntervalMap::iterator : public const_iterator {
91
// public:
92
//   void insert(KeyT a, KeyT b, Value y);
93
//   void erase();
94
// };
95
//
96
//===----------------------------------------------------------------------===//
97
98
#ifndef LLVM_ADT_INTERVALMAP_H
99
#define LLVM_ADT_INTERVALMAP_H
100
101
#include "llvm/ADT/PointerIntPair.h"
102
#include "llvm/ADT/SmallVector.h"
103
#include "llvm/ADT/bit.h"
104
#include "llvm/Support/AlignOf.h"
105
#include "llvm/Support/Allocator.h"
106
#include "llvm/Support/RecyclingAllocator.h"
107
#include <algorithm>
108
#include <cassert>
109
#include <cstdint>
110
#include <iterator>
111
#include <new>
112
#include <utility>
113
114
namespace llvm {
115
116
//===----------------------------------------------------------------------===//
117
//---                              Key traits                              ---//
118
//===----------------------------------------------------------------------===//
119
//
120
// The IntervalMap works with closed or half-open intervals.
121
// Adjacent intervals that map to the same value are coalesced.
122
//
123
// The IntervalMapInfo traits class is used to determine if a key is contained
124
// in an interval, and if two intervals are adjacent so they can be coalesced.
125
// The provided implementation works for closed integer intervals, other keys
126
// probably need a specialized version.
127
//
128
// The point x is contained in [a;b] when !startLess(x, a) && !stopLess(b, x).
129
//
130
// It is assumed that (a;b] half-open intervals are not used, only [a;b) is
131
// allowed. This is so that stopLess(a, b) can be used to determine if two
132
// intervals overlap.
133
//
134
//===----------------------------------------------------------------------===//
135
136
template <typename T>
137
struct IntervalMapInfo {
138
  /// startLess - Return true if x is not in [a;b].
139
  /// This is x < a both for closed intervals and for [a;b) half-open intervals.
140
  static inline bool startLess(const T &x, const T &a) {
141
    return x < a;
142
  }
143
144
  /// stopLess - Return true if x is not in [a;b].
145
  /// This is b < x for a closed interval, b <= x for [a;b) half-open intervals.
146
  static inline bool stopLess(const T &b, const T &x) {
147
    return b < x;
148
  }
149
150
  /// adjacent - Return true when the intervals [x;a] and [b;y] can coalesce.
151
  /// This is a+1 == b for closed intervals, a == b for half-open intervals.
152
  static inline bool adjacent(const T &a, const T &b) {
153
    return a+1 == b;
154
  }
155
156
  /// nonEmpty - Return true if [a;b] is non-empty.
157
  /// This is a <= b for a closed interval, a < b for [a;b) half-open intervals.
158
  static inline bool nonEmpty(const T &a, const T &b) {
159
    return a <= b;
160
  }
161
};
162
163
template <typename T>
164
struct IntervalMapHalfOpenInfo {
165
  /// startLess - Return true if x is not in [a;b).
166
3.67M
  static inline bool startLess(const T &x, const T &a) {
167
3.67M
    return x < a;
168
3.67M
  }
llvm::IntervalMapHalfOpenInfo<llvm::SlotIndex>::startLess(llvm::SlotIndex const&, llvm::SlotIndex const&)
Line
Count
Source
166
3.67M
  static inline bool startLess(const T &x, const T &a) {
167
3.67M
    return x < a;
168
3.67M
  }
llvm::IntervalMapHalfOpenInfo<long long>::startLess(long long const&, long long const&)
Line
Count
Source
166
1.19k
  static inline bool startLess(const T &x, const T &a) {
167
1.19k
    return x < a;
168
1.19k
  }
169
170
  /// stopLess - Return true if x is not in [a;b).
171
529M
  static inline bool stopLess(const T &b, const T &x) {
172
529M
    return b <= x;
173
529M
  }
llvm::IntervalMapHalfOpenInfo<llvm::SlotIndex>::stopLess(llvm::SlotIndex const&, llvm::SlotIndex const&)
Line
Count
Source
171
528M
  static inline bool stopLess(const T &b, const T &x) {
172
528M
    return b <= x;
173
528M
  }
llvm::IntervalMapHalfOpenInfo<long long>::stopLess(long long const&, long long const&)
Line
Count
Source
171
482k
  static inline bool stopLess(const T &b, const T &x) {
172
482k
    return b <= x;
173
482k
  }
174
175
  /// adjacent - Return true when the intervals [x;a) and [b;y) can coalesce.
176
14.1M
  static inline bool adjacent(const T &a, const T &b) {
177
14.1M
    return a == b;
178
14.1M
  }
llvm::IntervalMapHalfOpenInfo<llvm::SlotIndex>::adjacent(llvm::SlotIndex const&, llvm::SlotIndex const&)
Line
Count
Source
176
13.9M
  static inline bool adjacent(const T &a, const T &b) {
177
13.9M
    return a == b;
178
13.9M
  }
llvm::IntervalMapHalfOpenInfo<long long>::adjacent(long long const&, long long const&)
Line
Count
Source
176
223k
  static inline bool adjacent(const T &a, const T &b) {
177
223k
    return a == b;
178
223k
  }
179
180
  /// nonEmpty - Return true if [a;b) is non-empty.
181
  static inline bool nonEmpty(const T &a, const T &b) {
182
    return a < b;
183
  }
184
};
185
186
/// IntervalMapImpl - Namespace used for IntervalMap implementation details.
187
/// It should be considered private to the implementation.
188
namespace IntervalMapImpl {
189
190
using IdxPair = std::pair<unsigned,unsigned>;
191
192
//===----------------------------------------------------------------------===//
193
//---                    IntervalMapImpl::NodeBase                         ---//
194
//===----------------------------------------------------------------------===//
195
//
196
// Both leaf and branch nodes store vectors of pairs.
197
// Leaves store ((KeyT, KeyT), ValT) pairs, branches use (NodeRef, KeyT).
198
//
199
// Keys and values are stored in separate arrays to avoid padding caused by
200
// different object alignments. This also helps improve locality of reference
201
// when searching the keys.
202
//
203
// The nodes don't know how many elements they contain - that information is
204
// stored elsewhere. Omitting the size field prevents padding and allows a node
205
// to fill the allocated cache lines completely.
206
//
207
// These are typical key and value sizes, the node branching factor (N), and
208
// wasted space when nodes are sized to fit in three cache lines (192 bytes):
209
//
210
//   T1  T2   N Waste  Used by
211
//    4   4  24   0    Branch<4> (32-bit pointers)
212
//    8   4  16   0    Leaf<4,4>, Branch<4>
213
//    8   8  12   0    Leaf<4,8>, Branch<8>
214
//   16   4   9  12    Leaf<8,4>
215
//   16   8   8   0    Leaf<8,8>
216
//
217
//===----------------------------------------------------------------------===//
218
219
template <typename T1, typename T2, unsigned N>
220
class NodeBase {
221
public:
222
  enum { Capacity = N };
223
224
  T1 first[N];
225
  T2 second[N];
226
227
  /// copy - Copy elements from another node.
228
  /// @param Other Node elements are copied from.
229
  /// @param i     Beginning of the source range in other.
230
  /// @param j     Beginning of the destination range in this.
231
  /// @param Count Number of elements to copy.
232
  template <unsigned M>
233
  void copy(const NodeBase<T1, T2, M> &Other, unsigned i,
234
5.83M
            unsigned j, unsigned Count) {
235
5.83M
    assert(i + Count <= M && "Invalid source range");
236
5.83M
    assert(j + Count <= N && "Invalid dest range");
237
21.7M
    for (unsigned e = i + Count; i != e; 
++i, ++j15.9M
) {
238
15.9M
      first[j]  = Other.first[i];
239
15.9M
      second[j] = Other.second[i];
240
15.9M
    }
241
5.83M
  }
Unexecuted instantiation: void llvm::IntervalMapImpl::NodeBase<llvm::IntervalMapImpl::NodeRef, llvm::SlotIndex, 4u>::copy<4u>(llvm::IntervalMapImpl::NodeBase<llvm::IntervalMapImpl::NodeRef, llvm::SlotIndex, 4u> const&, unsigned int, unsigned int, unsigned int)
void llvm::IntervalMapImpl::NodeBase<llvm::IntervalMapImpl::NodeRef, llvm::SlotIndex, 12u>::copy<12u>(llvm::IntervalMapImpl::NodeBase<llvm::IntervalMapImpl::NodeRef, llvm::SlotIndex, 12u> const&, unsigned int, unsigned int, unsigned int)
Line
Count
Source
234
63.3k
            unsigned j, unsigned Count) {
235
63.3k
    assert(i + Count <= M && "Invalid source range");
236
63.3k
    assert(j + Count <= N && "Invalid dest range");
237
389k
    for (unsigned e = i + Count; i != e; 
++i, ++j326k
) {
238
326k
      first[j]  = Other.first[i];
239
326k
      second[j] = Other.second[i];
240
326k
    }
241
63.3k
  }
void llvm::IntervalMapImpl::NodeBase<std::__1::pair<llvm::SlotIndex, llvm::SlotIndex>, DbgValueLocation, 9u>::copy<9u>(llvm::IntervalMapImpl::NodeBase<std::__1::pair<llvm::SlotIndex, llvm::SlotIndex>, DbgValueLocation, 9u> const&, unsigned int, unsigned int, unsigned int)
Line
Count
Source
234
3
            unsigned j, unsigned Count) {
235
3
    assert(i + Count <= M && "Invalid source range");
236
3
    assert(j + Count <= N && "Invalid dest range");
237
6
    for (unsigned e = i + Count; i != e; 
++i, ++j3
) {
238
3
      first[j]  = Other.first[i];
239
3
      second[j] = Other.second[i];
240
3
    }
241
3
  }
Unexecuted instantiation: void llvm::IntervalMapImpl::NodeBase<llvm::IntervalMapImpl::NodeRef, llvm::SlotIndex, 12u>::copy<4u>(llvm::IntervalMapImpl::NodeBase<llvm::IntervalMapImpl::NodeRef, llvm::SlotIndex, 4u> const&, unsigned int, unsigned int, unsigned int)
void llvm::IntervalMapImpl::NodeBase<std::__1::pair<llvm::SlotIndex, llvm::SlotIndex>, DbgValueLocation, 4u>::copy<4u>(llvm::IntervalMapImpl::NodeBase<std::__1::pair<llvm::SlotIndex, llvm::SlotIndex>, DbgValueLocation, 4u> const&, unsigned int, unsigned int, unsigned int)
Line
Count
Source
234
12
            unsigned j, unsigned Count) {
235
12
    assert(i + Count <= M && "Invalid source range");
236
12
    assert(j + Count <= N && "Invalid dest range");
237
21
    for (unsigned e = i + Count; i != e; 
++i, ++j9
) {
238
9
      first[j]  = Other.first[i];
239
9
      second[j] = Other.second[i];
240
9
    }
241
12
  }
void llvm::IntervalMapImpl::NodeBase<std::__1::pair<llvm::SlotIndex, llvm::SlotIndex>, DbgValueLocation, 9u>::copy<4u>(llvm::IntervalMapImpl::NodeBase<std::__1::pair<llvm::SlotIndex, llvm::SlotIndex>, DbgValueLocation, 4u> const&, unsigned int, unsigned int, unsigned int)
Line
Count
Source
234
5
            unsigned j, unsigned Count) {
235
5
    assert(i + Count <= M && "Invalid source range");
236
5
    assert(j + Count <= N && "Invalid dest range");
237
25
    for (unsigned e = i + Count; i != e; 
++i, ++j20
) {
238
20
      first[j]  = Other.first[i];
239
20
      second[j] = Other.second[i];
240
20
    }
241
5
  }
void llvm::IntervalMapImpl::NodeBase<llvm::IntervalMapImpl::NodeRef, llvm::SlotIndex, 11u>::copy<11u>(llvm::IntervalMapImpl::NodeBase<llvm::IntervalMapImpl::NodeRef, llvm::SlotIndex, 11u> const&, unsigned int, unsigned int, unsigned int)
Line
Count
Source
234
38.0k
            unsigned j, unsigned Count) {
235
38.0k
    assert(i + Count <= M && "Invalid source range");
236
38.0k
    assert(j + Count <= N && "Invalid dest range");
237
82.3k
    for (unsigned e = i + Count; i != e; 
++i, ++j44.2k
) {
238
44.2k
      first[j]  = Other.first[i];
239
44.2k
      second[j] = Other.second[i];
240
44.2k
    }
241
38.0k
  }
void llvm::IntervalMapImpl::NodeBase<std::__1::pair<llvm::SlotIndex, llvm::SlotIndex>, llvm::LiveInterval*, 8u>::copy<8u>(llvm::IntervalMapImpl::NodeBase<std::__1::pair<llvm::SlotIndex, llvm::SlotIndex>, llvm::LiveInterval*, 8u> const&, unsigned int, unsigned int, unsigned int)
Line
Count
Source
234
5.21M
            unsigned j, unsigned Count) {
235
5.21M
    assert(i + Count <= M && "Invalid source range");
236
5.21M
    assert(j + Count <= N && "Invalid dest range");
237
19.5M
    for (unsigned e = i + Count; i != e; 
++i, ++j14.3M
) {
238
14.3M
      first[j]  = Other.first[i];
239
14.3M
      second[j] = Other.second[i];
240
14.3M
    }
241
5.21M
  }
void llvm::IntervalMapImpl::NodeBase<llvm::IntervalMapImpl::NodeRef, llvm::SlotIndex, 12u>::copy<11u>(llvm::IntervalMapImpl::NodeBase<llvm::IntervalMapImpl::NodeRef, llvm::SlotIndex, 11u> const&, unsigned int, unsigned int, unsigned int)
Line
Count
Source
234
7.47k
            unsigned j, unsigned Count) {
235
7.47k
    assert(i + Count <= M && "Invalid source range");
236
7.47k
    assert(j + Count <= N && "Invalid dest range");
237
89.6k
    for (unsigned e = i + Count; i != e; 
++i, ++j82.2k
) {
238
82.2k
      first[j]  = Other.first[i];
239
82.2k
      second[j] = Other.second[i];
240
82.2k
    }
241
7.47k
  }
void llvm::IntervalMapImpl::NodeBase<std::__1::pair<llvm::SlotIndex, llvm::SlotIndex>, unsigned int, 9u>::copy<9u>(llvm::IntervalMapImpl::NodeBase<std::__1::pair<llvm::SlotIndex, llvm::SlotIndex>, unsigned int, 9u> const&, unsigned int, unsigned int, unsigned int)
Line
Count
Source
234
518k
            unsigned j, unsigned Count) {
235
518k
    assert(i + Count <= M && "Invalid source range");
236
518k
    assert(j + Count <= N && "Invalid dest range");
237
1.68M
    for (unsigned e = i + Count; i != e; 
++i, ++j1.16M
) {
238
1.16M
      first[j]  = Other.first[i];
239
1.16M
      second[j] = Other.second[i];
240
1.16M
    }
241
518k
  }
Unexecuted instantiation: void llvm::IntervalMapImpl::NodeBase<llvm::IntervalMapImpl::NodeRef, long long, 8u>::copy<8u>(llvm::IntervalMapImpl::NodeBase<llvm::IntervalMapImpl::NodeRef, long long, 8u> const&, unsigned int, unsigned int, unsigned int)
Unexecuted instantiation: void llvm::IntervalMapImpl::NodeBase<llvm::IntervalMapImpl::NodeRef, long long, 12u>::copy<12u>(llvm::IntervalMapImpl::NodeBase<llvm::IntervalMapImpl::NodeRef, long long, 12u> const&, unsigned int, unsigned int, unsigned int)
DAGCombiner.cpp:void llvm::IntervalMapImpl::NodeBase<std::__1::pair<long long, long long>, (anonymous namespace)::UnitT, 11u>::copy<11u>(llvm::IntervalMapImpl::NodeBase<std::__1::pair<long long, long long>, (anonymous namespace)::UnitT, 11u> const&, unsigned int, unsigned int, unsigned int)
Line
Count
Source
234
284
            unsigned j, unsigned Count) {
235
284
    assert(i + Count <= M && "Invalid source range");
236
284
    assert(j + Count <= N && "Invalid dest range");
237
1.35k
    for (unsigned e = i + Count; i != e; 
++i, ++j1.07k
) {
238
1.07k
      first[j]  = Other.first[i];
239
1.07k
      second[j] = Other.second[i];
240
1.07k
    }
241
284
  }
Unexecuted instantiation: void llvm::IntervalMapImpl::NodeBase<llvm::IntervalMapImpl::NodeRef, long long, 12u>::copy<8u>(llvm::IntervalMapImpl::NodeBase<llvm::IntervalMapImpl::NodeRef, long long, 8u> const&, unsigned int, unsigned int, unsigned int)
DAGCombiner.cpp:void llvm::IntervalMapImpl::NodeBase<std::__1::pair<long long, long long>, (anonymous namespace)::UnitT, 11u>::copy<8u>(llvm::IntervalMapImpl::NodeBase<std::__1::pair<long long, long long>, (anonymous namespace)::UnitT, 8u> const&, unsigned int, unsigned int, unsigned int)
Line
Count
Source
234
92
            unsigned j, unsigned Count) {
235
92
    assert(i + Count <= M && "Invalid source range");
236
92
    assert(j + Count <= N && "Invalid dest range");
237
828
    for (unsigned e = i + Count; i != e; 
++i, ++j736
) {
238
736
      first[j]  = Other.first[i];
239
736
      second[j] = Other.second[i];
240
736
    }
241
92
  }
Unexecuted instantiation: DAGCombiner.cpp:void llvm::IntervalMapImpl::NodeBase<std::__1::pair<long long, long long>, (anonymous namespace)::UnitT, 8u>::copy<8u>(llvm::IntervalMapImpl::NodeBase<std::__1::pair<long long, long long>, (anonymous namespace)::UnitT, 8u> const&, unsigned int, unsigned int, unsigned int)
242
243
  /// moveLeft - Move elements to the left.
244
  /// @param i     Beginning of the source range.
245
  /// @param j     Beginning of the destination range.
246
  /// @param Count Number of elements to copy.
247
3.22M
  void moveLeft(unsigned i, unsigned j, unsigned Count) {
248
3.22M
    assert(j <= i && "Use moveRight shift elements right");
249
3.22M
    copy(*this, i, j, Count);
250
3.22M
  }
Unexecuted instantiation: llvm::IntervalMapImpl::NodeBase<llvm::IntervalMapImpl::NodeRef, llvm::SlotIndex, 4u>::moveLeft(unsigned int, unsigned int, unsigned int)
llvm::IntervalMapImpl::NodeBase<llvm::IntervalMapImpl::NodeRef, llvm::SlotIndex, 12u>::moveLeft(unsigned int, unsigned int, unsigned int)
Line
Count
Source
247
24.6k
  void moveLeft(unsigned i, unsigned j, unsigned Count) {
248
24.6k
    assert(j <= i && "Use moveRight shift elements right");
249
24.6k
    copy(*this, i, j, Count);
250
24.6k
  }
llvm::IntervalMapImpl::NodeBase<std::__1::pair<llvm::SlotIndex, llvm::SlotIndex>, DbgValueLocation, 9u>::moveLeft(unsigned int, unsigned int, unsigned int)
Line
Count
Source
247
3
  void moveLeft(unsigned i, unsigned j, unsigned Count) {
248
3
    assert(j <= i && "Use moveRight shift elements right");
249
3
    copy(*this, i, j, Count);
250
3
  }
llvm::IntervalMapImpl::NodeBase<std::__1::pair<llvm::SlotIndex, llvm::SlotIndex>, DbgValueLocation, 4u>::moveLeft(unsigned int, unsigned int, unsigned int)
Line
Count
Source
247
12
  void moveLeft(unsigned i, unsigned j, unsigned Count) {
248
12
    assert(j <= i && "Use moveRight shift elements right");
249
12
    copy(*this, i, j, Count);
250
12
  }
llvm::IntervalMapImpl::NodeBase<llvm::IntervalMapImpl::NodeRef, llvm::SlotIndex, 11u>::moveLeft(unsigned int, unsigned int, unsigned int)
Line
Count
Source
247
38.0k
  void moveLeft(unsigned i, unsigned j, unsigned Count) {
248
38.0k
    assert(j <= i && "Use moveRight shift elements right");
249
38.0k
    copy(*this, i, j, Count);
250
38.0k
  }
llvm::IntervalMapImpl::NodeBase<std::__1::pair<llvm::SlotIndex, llvm::SlotIndex>, llvm::LiveInterval*, 8u>::moveLeft(unsigned int, unsigned int, unsigned int)
Line
Count
Source
247
2.73M
  void moveLeft(unsigned i, unsigned j, unsigned Count) {
248
2.73M
    assert(j <= i && "Use moveRight shift elements right");
249
2.73M
    copy(*this, i, j, Count);
250
2.73M
  }
llvm::IntervalMapImpl::NodeBase<std::__1::pair<llvm::SlotIndex, llvm::SlotIndex>, unsigned int, 9u>::moveLeft(unsigned int, unsigned int, unsigned int)
Line
Count
Source
247
434k
  void moveLeft(unsigned i, unsigned j, unsigned Count) {
248
434k
    assert(j <= i && "Use moveRight shift elements right");
249
434k
    copy(*this, i, j, Count);
250
434k
  }
Unexecuted instantiation: llvm::IntervalMapImpl::NodeBase<llvm::IntervalMapImpl::NodeRef, long long, 8u>::moveLeft(unsigned int, unsigned int, unsigned int)
Unexecuted instantiation: llvm::IntervalMapImpl::NodeBase<llvm::IntervalMapImpl::NodeRef, long long, 12u>::moveLeft(unsigned int, unsigned int, unsigned int)
DAGCombiner.cpp:llvm::IntervalMapImpl::NodeBase<std::__1::pair<long long, long long>, (anonymous namespace)::UnitT, 11u>::moveLeft(unsigned int, unsigned int, unsigned int)
Line
Count
Source
247
44
  void moveLeft(unsigned i, unsigned j, unsigned Count) {
248
44
    assert(j <= i && "Use moveRight shift elements right");
249
44
    copy(*this, i, j, Count);
250
44
  }
Unexecuted instantiation: DAGCombiner.cpp:llvm::IntervalMapImpl::NodeBase<std::__1::pair<long long, long long>, (anonymous namespace)::UnitT, 8u>::moveLeft(unsigned int, unsigned int, unsigned int)
251
252
  /// moveRight - Move elements to the right.
253
  /// @param i     Beginning of the source range.
254
  /// @param j     Beginning of the destination range.
255
  /// @param Count Number of elements to copy.
256
9.30M
  void moveRight(unsigned i, unsigned j, unsigned Count) {
257
9.30M
    assert(i <= j && "Use moveLeft shift elements left");
258
9.30M
    assert(j + Count <= N && "Invalid range");
259
29.9M
    while (Count--) {
260
20.6M
      first[j + Count]  = first[i + Count];
261
20.6M
      second[j + Count] = second[i + Count];
262
20.6M
    }
263
9.30M
  }
llvm::IntervalMapImpl::NodeBase<std::__1::pair<llvm::SlotIndex, llvm::SlotIndex>, DbgValueLocation, 9u>::moveRight(unsigned int, unsigned int, unsigned int)
Line
Count
Source
256
6
  void moveRight(unsigned i, unsigned j, unsigned Count) {
257
6
    assert(i <= j && "Use moveLeft shift elements left");
258
6
    assert(j + Count <= N && "Invalid range");
259
16
    while (Count--) {
260
10
      first[j + Count]  = first[i + Count];
261
10
      second[j + Count] = second[i + Count];
262
10
    }
263
6
  }
Unexecuted instantiation: llvm::IntervalMapImpl::NodeBase<llvm::IntervalMapImpl::NodeRef, llvm::SlotIndex, 4u>::moveRight(unsigned int, unsigned int, unsigned int)
llvm::IntervalMapImpl::NodeBase<llvm::IntervalMapImpl::NodeRef, llvm::SlotIndex, 12u>::moveRight(unsigned int, unsigned int, unsigned int)
Line
Count
Source
256
124k
  void moveRight(unsigned i, unsigned j, unsigned Count) {
257
124k
    assert(i <= j && "Use moveLeft shift elements left");
258
124k
    assert(j + Count <= N && "Invalid range");
259
494k
    while (Count--) {
260
370k
      first[j + Count]  = first[i + Count];
261
370k
      second[j + Count] = second[i + Count];
262
370k
    }
263
124k
  }
llvm::IntervalMapImpl::NodeBase<std::__1::pair<llvm::SlotIndex, llvm::SlotIndex>, DbgValueLocation, 4u>::moveRight(unsigned int, unsigned int, unsigned int)
Line
Count
Source
256
9
  void moveRight(unsigned i, unsigned j, unsigned Count) {
257
9
    assert(i <= j && "Use moveLeft shift elements left");
258
9
    assert(j + Count <= N && "Invalid range");
259
22
    while (Count--) {
260
13
      first[j + Count]  = first[i + Count];
261
13
      second[j + Count] = second[i + Count];
262
13
    }
263
9
  }
llvm::IntervalMapImpl::NodeBase<std::__1::pair<llvm::SlotIndex, llvm::SlotIndex>, llvm::LiveInterval*, 8u>::moveRight(unsigned int, unsigned int, unsigned int)
Line
Count
Source
256
8.29M
  void moveRight(unsigned i, unsigned j, unsigned Count) {
257
8.29M
    assert(i <= j && "Use moveLeft shift elements left");
258
8.29M
    assert(j + Count <= N && "Invalid range");
259
26.7M
    while (Count--) {
260
18.4M
      first[j + Count]  = first[i + Count];
261
18.4M
      second[j + Count] = second[i + Count];
262
18.4M
    }
263
8.29M
  }
llvm::IntervalMapImpl::NodeBase<llvm::IntervalMapImpl::NodeRef, llvm::SlotIndex, 11u>::moveRight(unsigned int, unsigned int, unsigned int)
Line
Count
Source
256
338k
  void moveRight(unsigned i, unsigned j, unsigned Count) {
257
338k
    assert(i <= j && "Use moveLeft shift elements left");
258
338k
    assert(j + Count <= N && "Invalid range");
259
799k
    while (Count--) {
260
460k
      first[j + Count]  = first[i + Count];
261
460k
      second[j + Count] = second[i + Count];
262
460k
    }
263
338k
  }
llvm::IntervalMapImpl::NodeBase<std::__1::pair<llvm::SlotIndex, llvm::SlotIndex>, unsigned int, 9u>::moveRight(unsigned int, unsigned int, unsigned int)
Line
Count
Source
256
519k
  void moveRight(unsigned i, unsigned j, unsigned Count) {
257
519k
    assert(i <= j && "Use moveLeft shift elements left");
258
519k
    assert(j + Count <= N && "Invalid range");
259
1.85M
    while (Count--) {
260
1.33M
      first[j + Count]  = first[i + Count];
261
1.33M
      second[j + Count] = second[i + Count];
262
1.33M
    }
263
519k
  }
DAGCombiner.cpp:llvm::IntervalMapImpl::NodeBase<std::__1::pair<long long, long long>, (anonymous namespace)::UnitT, 11u>::moveRight(unsigned int, unsigned int, unsigned int)
Line
Count
Source
256
908
  void moveRight(unsigned i, unsigned j, unsigned Count) {
257
908
    assert(i <= j && "Use moveLeft shift elements left");
258
908
    assert(j + Count <= N && "Invalid range");
259
8.14k
    while (Count--) {
260
7.23k
      first[j + Count]  = first[i + Count];
261
7.23k
      second[j + Count] = second[i + Count];
262
7.23k
    }
263
908
  }
llvm::IntervalMapImpl::NodeBase<llvm::IntervalMapImpl::NodeRef, long long, 8u>::moveRight(unsigned int, unsigned int, unsigned int)
Line
Count
Source
256
84
  void moveRight(unsigned i, unsigned j, unsigned Count) {
257
84
    assert(i <= j && "Use moveLeft shift elements left");
258
84
    assert(j + Count <= N && "Invalid range");
259
202
    while (Count--) {
260
118
      first[j + Count]  = first[i + Count];
261
118
      second[j + Count] = second[i + Count];
262
118
    }
263
84
  }
Unexecuted instantiation: llvm::IntervalMapImpl::NodeBase<llvm::IntervalMapImpl::NodeRef, long long, 12u>::moveRight(unsigned int, unsigned int, unsigned int)
DAGCombiner.cpp:llvm::IntervalMapImpl::NodeBase<std::__1::pair<long long, long long>, (anonymous namespace)::UnitT, 8u>::moveRight(unsigned int, unsigned int, unsigned int)
Line
Count
Source
256
24.9k
  void moveRight(unsigned i, unsigned j, unsigned Count) {
257
24.9k
    assert(i <= j && "Use moveLeft shift elements left");
258
24.9k
    assert(j + Count <= N && "Invalid range");
259
60.4k
    while (Count--) {
260
35.4k
      first[j + Count]  = first[i + Count];
261
35.4k
      second[j + Count] = second[i + Count];
262
35.4k
    }
263
24.9k
  }
264
265
  /// erase - Erase elements [i;j).
266
  /// @param i    Beginning of the range to erase.
267
  /// @param j    End of the range. (Exclusive).
268
  /// @param Size Number of elements in node.
269
3.22M
  void erase(unsigned i, unsigned j, unsigned Size) {
270
3.22M
    moveLeft(j, i, Size - j);
271
3.22M
  }
Unexecuted instantiation: llvm::IntervalMapImpl::NodeBase<llvm::IntervalMapImpl::NodeRef, llvm::SlotIndex, 4u>::erase(unsigned int, unsigned int, unsigned int)
llvm::IntervalMapImpl::NodeBase<llvm::IntervalMapImpl::NodeRef, llvm::SlotIndex, 12u>::erase(unsigned int, unsigned int, unsigned int)
Line
Count
Source
269
24.6k
  void erase(unsigned i, unsigned j, unsigned Size) {
270
24.6k
    moveLeft(j, i, Size - j);
271
24.6k
  }
llvm::IntervalMapImpl::NodeBase<std::__1::pair<llvm::SlotIndex, llvm::SlotIndex>, DbgValueLocation, 9u>::erase(unsigned int, unsigned int, unsigned int)
Line
Count
Source
269
3
  void erase(unsigned i, unsigned j, unsigned Size) {
270
3
    moveLeft(j, i, Size - j);
271
3
  }
llvm::IntervalMapImpl::NodeBase<std::__1::pair<llvm::SlotIndex, llvm::SlotIndex>, DbgValueLocation, 4u>::erase(unsigned int, unsigned int, unsigned int)
Line
Count
Source
269
12
  void erase(unsigned i, unsigned j, unsigned Size) {
270
12
    moveLeft(j, i, Size - j);
271
12
  }
llvm::IntervalMapImpl::NodeBase<llvm::IntervalMapImpl::NodeRef, llvm::SlotIndex, 11u>::erase(unsigned int, unsigned int, unsigned int)
Line
Count
Source
269
38.0k
  void erase(unsigned i, unsigned j, unsigned Size) {
270
38.0k
    moveLeft(j, i, Size - j);
271
38.0k
  }
llvm::IntervalMapImpl::NodeBase<std::__1::pair<llvm::SlotIndex, llvm::SlotIndex>, llvm::LiveInterval*, 8u>::erase(unsigned int, unsigned int, unsigned int)
Line
Count
Source
269
2.73M
  void erase(unsigned i, unsigned j, unsigned Size) {
270
2.73M
    moveLeft(j, i, Size - j);
271
2.73M
  }
llvm::IntervalMapImpl::NodeBase<std::__1::pair<llvm::SlotIndex, llvm::SlotIndex>, unsigned int, 9u>::erase(unsigned int, unsigned int, unsigned int)
Line
Count
Source
269
434k
  void erase(unsigned i, unsigned j, unsigned Size) {
270
434k
    moveLeft(j, i, Size - j);
271
434k
  }
Unexecuted instantiation: llvm::IntervalMapImpl::NodeBase<llvm::IntervalMapImpl::NodeRef, long long, 8u>::erase(unsigned int, unsigned int, unsigned int)
Unexecuted instantiation: llvm::IntervalMapImpl::NodeBase<llvm::IntervalMapImpl::NodeRef, long long, 12u>::erase(unsigned int, unsigned int, unsigned int)
DAGCombiner.cpp:llvm::IntervalMapImpl::NodeBase<std::__1::pair<long long, long long>, (anonymous namespace)::UnitT, 11u>::erase(unsigned int, unsigned int, unsigned int)
Line
Count
Source
269
44
  void erase(unsigned i, unsigned j, unsigned Size) {
270
44
    moveLeft(j, i, Size - j);
271
44
  }
Unexecuted instantiation: DAGCombiner.cpp:llvm::IntervalMapImpl::NodeBase<std::__1::pair<long long, long long>, (anonymous namespace)::UnitT, 8u>::erase(unsigned int, unsigned int, unsigned int)
272
273
  /// erase - Erase element at i.
274
  /// @param i    Index of element to erase.
275
  /// @param Size Number of elements in node.
276
2.16M
  void erase(unsigned i, unsigned Size) {
277
2.16M
    erase(i, i+1, Size);
278
2.16M
  }
Unexecuted instantiation: llvm::IntervalMapImpl::NodeBase<llvm::IntervalMapImpl::NodeRef, llvm::SlotIndex, 4u>::erase(unsigned int, unsigned int)
llvm::IntervalMapImpl::NodeBase<llvm::IntervalMapImpl::NodeRef, llvm::SlotIndex, 12u>::erase(unsigned int, unsigned int)
Line
Count
Source
276
3.49k
  void erase(unsigned i, unsigned Size) {
277
3.49k
    erase(i, i+1, Size);
278
3.49k
  }
llvm::IntervalMapImpl::NodeBase<std::__1::pair<llvm::SlotIndex, llvm::SlotIndex>, DbgValueLocation, 9u>::erase(unsigned int, unsigned int)
Line
Count
Source
276
3
  void erase(unsigned i, unsigned Size) {
277
3
    erase(i, i+1, Size);
278
3
  }
llvm::IntervalMapImpl::NodeBase<std::__1::pair<llvm::SlotIndex, llvm::SlotIndex>, DbgValueLocation, 4u>::erase(unsigned int, unsigned int)
Line
Count
Source
276
12
  void erase(unsigned i, unsigned Size) {
277
12
    erase(i, i+1, Size);
278
12
  }
llvm::IntervalMapImpl::NodeBase<llvm::IntervalMapImpl::NodeRef, llvm::SlotIndex, 11u>::erase(unsigned int, unsigned int)
Line
Count
Source
276
38.0k
  void erase(unsigned i, unsigned Size) {
277
38.0k
    erase(i, i+1, Size);
278
38.0k
  }
llvm::IntervalMapImpl::NodeBase<std::__1::pair<llvm::SlotIndex, llvm::SlotIndex>, llvm::LiveInterval*, 8u>::erase(unsigned int, unsigned int)
Line
Count
Source
276
1.72M
  void erase(unsigned i, unsigned Size) {
277
1.72M
    erase(i, i+1, Size);
278
1.72M
  }
llvm::IntervalMapImpl::NodeBase<std::__1::pair<llvm::SlotIndex, llvm::SlotIndex>, unsigned int, 9u>::erase(unsigned int, unsigned int)
Line
Count
Source
276
402k
  void erase(unsigned i, unsigned Size) {
277
402k
    erase(i, i+1, Size);
278
402k
  }
Unexecuted instantiation: llvm::IntervalMapImpl::NodeBase<llvm::IntervalMapImpl::NodeRef, long long, 8u>::erase(unsigned int, unsigned int)
Unexecuted instantiation: llvm::IntervalMapImpl::NodeBase<llvm::IntervalMapImpl::NodeRef, long long, 12u>::erase(unsigned int, unsigned int)
Unexecuted instantiation: DAGCombiner.cpp:llvm::IntervalMapImpl::NodeBase<std::__1::pair<long long, long long>, (anonymous namespace)::UnitT, 11u>::erase(unsigned int, unsigned int)
Unexecuted instantiation: DAGCombiner.cpp:llvm::IntervalMapImpl::NodeBase<std::__1::pair<long long, long long>, (anonymous namespace)::UnitT, 8u>::erase(unsigned int, unsigned int)
279
280
  /// shift - Shift elements [i;size) 1 position to the right.
281
  /// @param i    Beginning of the range to move.
282
  /// @param Size Number of elements in node.
283
8.41M
  void shift(unsigned i, unsigned Size) {
284
8.41M
    moveRight(i, i + 1, Size - i);
285
8.41M
  }
llvm::IntervalMapImpl::NodeBase<std::__1::pair<llvm::SlotIndex, llvm::SlotIndex>, DbgValueLocation, 9u>::shift(unsigned int, unsigned int)
Line
Count
Source
283
6
  void shift(unsigned i, unsigned Size) {
284
6
    moveRight(i, i + 1, Size - i);
285
6
  }
Unexecuted instantiation: llvm::IntervalMapImpl::NodeBase<llvm::IntervalMapImpl::NodeRef, llvm::SlotIndex, 4u>::shift(unsigned int, unsigned int)
llvm::IntervalMapImpl::NodeBase<llvm::IntervalMapImpl::NodeRef, llvm::SlotIndex, 12u>::shift(unsigned int, unsigned int)
Line
Count
Source
283
106k
  void shift(unsigned i, unsigned Size) {
284
106k
    moveRight(i, i + 1, Size - i);
285
106k
  }
llvm::IntervalMapImpl::NodeBase<std::__1::pair<llvm::SlotIndex, llvm::SlotIndex>, DbgValueLocation, 4u>::shift(unsigned int, unsigned int)
Line
Count
Source
283
9
  void shift(unsigned i, unsigned Size) {
284
9
    moveRight(i, i + 1, Size - i);
285
9
  }
llvm::IntervalMapImpl::NodeBase<llvm::IntervalMapImpl::NodeRef, llvm::SlotIndex, 11u>::shift(unsigned int, unsigned int)
Line
Count
Source
283
338k
  void shift(unsigned i, unsigned Size) {
284
338k
    moveRight(i, i + 1, Size - i);
285
338k
  }
llvm::IntervalMapImpl::NodeBase<std::__1::pair<llvm::SlotIndex, llvm::SlotIndex>, llvm::LiveInterval*, 8u>::shift(unsigned int, unsigned int)
Line
Count
Source
283
7.44M
  void shift(unsigned i, unsigned Size) {
284
7.44M
    moveRight(i, i + 1, Size - i);
285
7.44M
  }
llvm::IntervalMapImpl::NodeBase<std::__1::pair<llvm::SlotIndex, llvm::SlotIndex>, unsigned int, 9u>::shift(unsigned int, unsigned int)
Line
Count
Source
283
500k
  void shift(unsigned i, unsigned Size) {
284
500k
    moveRight(i, i + 1, Size - i);
285
500k
  }
DAGCombiner.cpp:llvm::IntervalMapImpl::NodeBase<std::__1::pair<long long, long long>, (anonymous namespace)::UnitT, 11u>::shift(unsigned int, unsigned int)
Line
Count
Source
283
712
  void shift(unsigned i, unsigned Size) {
284
712
    moveRight(i, i + 1, Size - i);
285
712
  }
llvm::IntervalMapImpl::NodeBase<llvm::IntervalMapImpl::NodeRef, long long, 8u>::shift(unsigned int, unsigned int)
Line
Count
Source
283
84
  void shift(unsigned i, unsigned Size) {
284
84
    moveRight(i, i + 1, Size - i);
285
84
  }
Unexecuted instantiation: llvm::IntervalMapImpl::NodeBase<llvm::IntervalMapImpl::NodeRef, long long, 12u>::shift(unsigned int, unsigned int)
DAGCombiner.cpp:llvm::IntervalMapImpl::NodeBase<std::__1::pair<long long, long long>, (anonymous namespace)::UnitT, 8u>::shift(unsigned int, unsigned int)
Line
Count
Source
283
24.9k
  void shift(unsigned i, unsigned Size) {
284
24.9k
    moveRight(i, i + 1, Size - i);
285
24.9k
  }
286
287
  /// transferToLeftSib - Transfer elements to a left sibling node.
288
  /// @param Size  Number of elements in this.
289
  /// @param Sib   Left sibling node.
290
  /// @param SSize Number of elements in sib.
291
  /// @param Count Number of elements to transfer.
292
  void transferToLeftSib(unsigned Size, NodeBase &Sib, unsigned SSize,
293
1.06M
                         unsigned Count) {
294
1.06M
    Sib.copy(*this, 0, SSize, Count);
295
1.06M
    erase(0, Count, Size);
296
1.06M
  }
Unexecuted instantiation: llvm::IntervalMapImpl::NodeBase<std::__1::pair<llvm::SlotIndex, llvm::SlotIndex>, DbgValueLocation, 9u>::transferToLeftSib(unsigned int, llvm::IntervalMapImpl::NodeBase<std::__1::pair<llvm::SlotIndex, llvm::SlotIndex>, DbgValueLocation, 9u>&, unsigned int, unsigned int)
llvm::IntervalMapImpl::NodeBase<llvm::IntervalMapImpl::NodeRef, llvm::SlotIndex, 12u>::transferToLeftSib(unsigned int, llvm::IntervalMapImpl::NodeBase<llvm::IntervalMapImpl::NodeRef, llvm::SlotIndex, 12u>&, unsigned int, unsigned int)
Line
Count
Source
293
21.1k
                         unsigned Count) {
294
21.1k
    Sib.copy(*this, 0, SSize, Count);
295
21.1k
    erase(0, Count, Size);
296
21.1k
  }
llvm::IntervalMapImpl::NodeBase<std::__1::pair<llvm::SlotIndex, llvm::SlotIndex>, llvm::LiveInterval*, 8u>::transferToLeftSib(unsigned int, llvm::IntervalMapImpl::NodeBase<std::__1::pair<llvm::SlotIndex, llvm::SlotIndex>, llvm::LiveInterval*, 8u>&, unsigned int, unsigned int)
Line
Count
Source
293
1.00M
                         unsigned Count) {
294
1.00M
    Sib.copy(*this, 0, SSize, Count);
295
1.00M
    erase(0, Count, Size);
296
1.00M
  }
llvm::IntervalMapImpl::NodeBase<std::__1::pair<llvm::SlotIndex, llvm::SlotIndex>, unsigned int, 9u>::transferToLeftSib(unsigned int, llvm::IntervalMapImpl::NodeBase<std::__1::pair<llvm::SlotIndex, llvm::SlotIndex>, unsigned int, 9u>&, unsigned int, unsigned int)
Line
Count
Source
293
32.2k
                         unsigned Count) {
294
32.2k
    Sib.copy(*this, 0, SSize, Count);
295
32.2k
    erase(0, Count, Size);
296
32.2k
  }
DAGCombiner.cpp:llvm::IntervalMapImpl::NodeBase<std::__1::pair<long long, long long>, (anonymous namespace)::UnitT, 11u>::transferToLeftSib(unsigned int, llvm::IntervalMapImpl::NodeBase<std::__1::pair<long long, long long>, (anonymous namespace)::UnitT, 11u>&, unsigned int, unsigned int)
Line
Count
Source
293
44
                         unsigned Count) {
294
44
    Sib.copy(*this, 0, SSize, Count);
295
44
    erase(0, Count, Size);
296
44
  }
Unexecuted instantiation: llvm::IntervalMapImpl::NodeBase<llvm::IntervalMapImpl::NodeRef, long long, 12u>::transferToLeftSib(unsigned int, llvm::IntervalMapImpl::NodeBase<llvm::IntervalMapImpl::NodeRef, long long, 12u>&, unsigned int, unsigned int)
297
298
  /// transferToRightSib - Transfer elements to a right sibling node.
299
  /// @param Size  Number of elements in this.
300
  /// @param Sib   Right sibling node.
301
  /// @param SSize Number of elements in sib.
302
  /// @param Count Number of elements to transfer.
303
  void transferToRightSib(unsigned Size, NodeBase &Sib, unsigned SSize,
304
888k
                          unsigned Count) {
305
888k
    Sib.moveRight(0, Count, SSize);
306
888k
    Sib.copy(*this, Size-Count, 0, Count);
307
888k
  }
Unexecuted instantiation: llvm::IntervalMapImpl::NodeBase<std::__1::pair<llvm::SlotIndex, llvm::SlotIndex>, DbgValueLocation, 9u>::transferToRightSib(unsigned int, llvm::IntervalMapImpl::NodeBase<std::__1::pair<llvm::SlotIndex, llvm::SlotIndex>, DbgValueLocation, 9u>&, unsigned int, unsigned int)
llvm::IntervalMapImpl::NodeBase<llvm::IntervalMapImpl::NodeRef, llvm::SlotIndex, 12u>::transferToRightSib(unsigned int, llvm::IntervalMapImpl::NodeBase<llvm::IntervalMapImpl::NodeRef, llvm::SlotIndex, 12u>&, unsigned int, unsigned int)
Line
Count
Source
304
17.6k
                          unsigned Count) {
305
17.6k
    Sib.moveRight(0, Count, SSize);
306
17.6k
    Sib.copy(*this, Size-Count, 0, Count);
307
17.6k
  }
llvm::IntervalMapImpl::NodeBase<std::__1::pair<llvm::SlotIndex, llvm::SlotIndex>, llvm::LiveInterval*, 8u>::transferToRightSib(unsigned int, llvm::IntervalMapImpl::NodeBase<std::__1::pair<llvm::SlotIndex, llvm::SlotIndex>, llvm::LiveInterval*, 8u>&, unsigned int, unsigned int)
Line
Count
Source
304
851k
                          unsigned Count) {
305
851k
    Sib.moveRight(0, Count, SSize);
306
851k
    Sib.copy(*this, Size-Count, 0, Count);
307
851k
  }
llvm::IntervalMapImpl::NodeBase<std::__1::pair<llvm::SlotIndex, llvm::SlotIndex>, unsigned int, 9u>::transferToRightSib(unsigned int, llvm::IntervalMapImpl::NodeBase<std::__1::pair<llvm::SlotIndex, llvm::SlotIndex>, unsigned int, 9u>&, unsigned int, unsigned int)
Line
Count
Source
304
19.2k
                          unsigned Count) {
305
19.2k
    Sib.moveRight(0, Count, SSize);
306
19.2k
    Sib.copy(*this, Size-Count, 0, Count);
307
19.2k
  }
DAGCombiner.cpp:llvm::IntervalMapImpl::NodeBase<std::__1::pair<long long, long long>, (anonymous namespace)::UnitT, 11u>::transferToRightSib(unsigned int, llvm::IntervalMapImpl::NodeBase<std::__1::pair<long long, long long>, (anonymous namespace)::UnitT, 11u>&, unsigned int, unsigned int)
Line
Count
Source
304
196
                          unsigned Count) {
305
196
    Sib.moveRight(0, Count, SSize);
306
196
    Sib.copy(*this, Size-Count, 0, Count);
307
196
  }
Unexecuted instantiation: llvm::IntervalMapImpl::NodeBase<llvm::IntervalMapImpl::NodeRef, long long, 12u>::transferToRightSib(unsigned int, llvm::IntervalMapImpl::NodeBase<llvm::IntervalMapImpl::NodeRef, long long, 12u>&, unsigned int, unsigned int)
308
309
  /// adjustFromLeftSib - Adjust the number if elements in this node by moving
310
  /// elements to or from a left sibling node.
311
  /// @param Size  Number of elements in this.
312
  /// @param Sib   Right sibling node.
313
  /// @param SSize Number of elements in sib.
314
  /// @param Add   The number of elements to add to this node, possibly < 0.
315
  /// @return      Number of elements added to this node, possibly negative.
316
1.95M
  int adjustFromLeftSib(unsigned Size, NodeBase &Sib, unsigned SSize, int Add) {
317
1.95M
    if (Add > 0) {
318
888k
      // We want to grow, copy from sib.
319
888k
      unsigned Count = std::min(std::min(unsigned(Add), SSize), N - Size);
320
888k
      Sib.transferToRightSib(SSize, *this, Size, Count);
321
888k
      return Count;
322
1.06M
    } else {
323
1.06M
      // We want to shrink, copy to sib.
324
1.06M
      unsigned Count = std::min(std::min(unsigned(-Add), Size), N - SSize);
325
1.06M
      transferToLeftSib(Size, Sib, SSize, Count);
326
1.06M
      return -Count;
327
1.06M
    }
328
1.95M
  }
Unexecuted instantiation: llvm::IntervalMapImpl::NodeBase<std::__1::pair<llvm::SlotIndex, llvm::SlotIndex>, DbgValueLocation, 9u>::adjustFromLeftSib(unsigned int, llvm::IntervalMapImpl::NodeBase<std::__1::pair<llvm::SlotIndex, llvm::SlotIndex>, DbgValueLocation, 9u>&, unsigned int, int)
llvm::IntervalMapImpl::NodeBase<llvm::IntervalMapImpl::NodeRef, llvm::SlotIndex, 12u>::adjustFromLeftSib(unsigned int, llvm::IntervalMapImpl::NodeBase<llvm::IntervalMapImpl::NodeRef, llvm::SlotIndex, 12u>&, unsigned int, int)
Line
Count
Source
316
38.7k
  int adjustFromLeftSib(unsigned Size, NodeBase &Sib, unsigned SSize, int Add) {
317
38.7k
    if (Add > 0) {
318
17.6k
      // We want to grow, copy from sib.
319
17.6k
      unsigned Count = std::min(std::min(unsigned(Add), SSize), N - Size);
320
17.6k
      Sib.transferToRightSib(SSize, *this, Size, Count);
321
17.6k
      return Count;
322
21.1k
    } else {
323
21.1k
      // We want to shrink, copy to sib.
324
21.1k
      unsigned Count = std::min(std::min(unsigned(-Add), Size), N - SSize);
325
21.1k
      transferToLeftSib(Size, Sib, SSize, Count);
326
21.1k
      return -Count;
327
21.1k
    }
328
38.7k
  }
llvm::IntervalMapImpl::NodeBase<std::__1::pair<llvm::SlotIndex, llvm::SlotIndex>, llvm::LiveInterval*, 8u>::adjustFromLeftSib(unsigned int, llvm::IntervalMapImpl::NodeBase<std::__1::pair<llvm::SlotIndex, llvm::SlotIndex>, llvm::LiveInterval*, 8u>&, unsigned int, int)
Line
Count
Source
316
1.86M
  int adjustFromLeftSib(unsigned Size, NodeBase &Sib, unsigned SSize, int Add) {
317
1.86M
    if (Add > 0) {
318
851k
      // We want to grow, copy from sib.
319
851k
      unsigned Count = std::min(std::min(unsigned(Add), SSize), N - Size);
320
851k
      Sib.transferToRightSib(SSize, *this, Size, Count);
321
851k
      return Count;
322
1.00M
    } else {
323
1.00M
      // We want to shrink, copy to sib.
324
1.00M
      unsigned Count = std::min(std::min(unsigned(-Add), Size), N - SSize);
325
1.00M
      transferToLeftSib(Size, Sib, SSize, Count);
326
1.00M
      return -Count;
327
1.00M
    }
328
1.86M
  }
llvm::IntervalMapImpl::NodeBase<std::__1::pair<llvm::SlotIndex, llvm::SlotIndex>, unsigned int, 9u>::adjustFromLeftSib(unsigned int, llvm::IntervalMapImpl::NodeBase<std::__1::pair<llvm::SlotIndex, llvm::SlotIndex>, unsigned int, 9u>&, unsigned int, int)
Line
Count
Source
316
51.5k
  int adjustFromLeftSib(unsigned Size, NodeBase &Sib, unsigned SSize, int Add) {
317
51.5k
    if (Add > 0) {
318
19.2k
      // We want to grow, copy from sib.
319
19.2k
      unsigned Count = std::min(std::min(unsigned(Add), SSize), N - Size);
320
19.2k
      Sib.transferToRightSib(SSize, *this, Size, Count);
321
19.2k
      return Count;
322
32.2k
    } else {
323
32.2k
      // We want to shrink, copy to sib.
324
32.2k
      unsigned Count = std::min(std::min(unsigned(-Add), Size), N - SSize);
325
32.2k
      transferToLeftSib(Size, Sib, SSize, Count);
326
32.2k
      return -Count;
327
32.2k
    }
328
51.5k
  }
DAGCombiner.cpp:llvm::IntervalMapImpl::NodeBase<std::__1::pair<long long, long long>, (anonymous namespace)::UnitT, 11u>::adjustFromLeftSib(unsigned int, llvm::IntervalMapImpl::NodeBase<std::__1::pair<long long, long long>, (anonymous namespace)::UnitT, 11u>&, unsigned int, int)
Line
Count
Source
316
240
  int adjustFromLeftSib(unsigned Size, NodeBase &Sib, unsigned SSize, int Add) {
317
240
    if (Add > 0) {
318
196
      // We want to grow, copy from sib.
319
196
      unsigned Count = std::min(std::min(unsigned(Add), SSize), N - Size);
320
196
      Sib.transferToRightSib(SSize, *this, Size, Count);
321
196
      return Count;
322
196
    } else {
323
44
      // We want to shrink, copy to sib.
324
44
      unsigned Count = std::min(std::min(unsigned(-Add), Size), N - SSize);
325
44
      transferToLeftSib(Size, Sib, SSize, Count);
326
44
      return -Count;
327
44
    }
328
240
  }
Unexecuted instantiation: llvm::IntervalMapImpl::NodeBase<llvm::IntervalMapImpl::NodeRef, long long, 12u>::adjustFromLeftSib(unsigned int, llvm::IntervalMapImpl::NodeBase<llvm::IntervalMapImpl::NodeRef, long long, 12u>&, unsigned int, int)
329
};
330
331
/// IntervalMapImpl::adjustSiblingSizes - Move elements between sibling nodes.
332
/// @param Node  Array of pointers to sibling nodes.
333
/// @param Nodes Number of nodes.
334
/// @param CurSize Array of current node sizes, will be overwritten.
335
/// @param NewSize Array of desired node sizes.
336
template <typename NodeT>
337
void adjustSiblingSizes(NodeT *Node[], unsigned Nodes,
338
1.29M
                        unsigned CurSize[], const unsigned NewSize[]) {
339
1.29M
  // Move elements right.
340
3.41M
  for (int n = Nodes - 1; n; 
--n2.12M
) {
341
2.12M
    if (CurSize[n] == NewSize[n])
342
202k
      continue;
343
1.92M
    for (int m = n - 1; m != -1; 
--m0
) {
344
1.92M
      int d = Node[n]->adjustFromLeftSib(CurSize[n], *Node[m], CurSize[m],
345
1.92M
                                         NewSize[n] - CurSize[n]);
346
1.92M
      CurSize[m] -= d;
347
1.92M
      CurSize[n] += d;
348
1.92M
      // Keep going if the current node was exhausted.
349
1.92M
      if (CurSize[n] >= NewSize[n])
350
1.92M
          break;
351
1.92M
    }
352
1.92M
  }
353
1.29M
354
1.29M
  if (Nodes == 0)
355
0
    return;
356
1.29M
357
1.29M
  // Move elements left.
358
3.41M
  
for (unsigned n = 0; 1.29M
n != Nodes - 1;
++n2.12M
) {
359
2.12M
    if (CurSize[n] == NewSize[n])
360
2.09M
      continue;
361
28.0k
    for (unsigned m = n + 1; m != Nodes; 
++m0
) {
362
28.0k
      int d = Node[m]->adjustFromLeftSib(CurSize[m], *Node[n], CurSize[n],
363
28.0k
                                        CurSize[n] -  NewSize[n]);
364
28.0k
      CurSize[m] += d;
365
28.0k
      CurSize[n] -= d;
366
28.0k
      // Keep going if the current node was exhausted.
367
28.0k
      if (CurSize[n] >= NewSize[n])
368
28.0k
          break;
369
28.0k
    }
370
28.0k
  }
371
1.29M
372
1.29M
#ifndef NDEBUG
373
1.29M
  for (unsigned n = 0; n != Nodes; n++)
374
1.29M
    assert(CurSize[n] == NewSize[n] && "Insufficient element shuffle");
375
1.29M
#endif
376
1.29M
}
Unexecuted instantiation: void llvm::IntervalMapImpl::adjustSiblingSizes<llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, DbgValueLocation, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> > >(llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, DbgValueLocation, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >**, unsigned int, unsigned int*, unsigned int const*)
Unexecuted instantiation: void llvm::IntervalMapImpl::adjustSiblingSizes<llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, DbgValueLocation, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> > >(llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, DbgValueLocation, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> >**, unsigned int, unsigned int*, unsigned int const*)
void llvm::IntervalMapImpl::adjustSiblingSizes<llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> > >(llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >**, unsigned int, unsigned int*, unsigned int const*)
Line
Count
Source
338
1.22M
                        unsigned CurSize[], const unsigned NewSize[]) {
339
1.22M
  // Move elements right.
340
3.25M
  for (int n = Nodes - 1; n; 
--n2.03M
) {
341
2.03M
    if (CurSize[n] == NewSize[n])
342
197k
      continue;
343
1.83M
    for (int m = n - 1; m != -1; 
--m0
) {
344
1.83M
      int d = Node[n]->adjustFromLeftSib(CurSize[n], *Node[m], CurSize[m],
345
1.83M
                                         NewSize[n] - CurSize[n]);
346
1.83M
      CurSize[m] -= d;
347
1.83M
      CurSize[n] += d;
348
1.83M
      // Keep going if the current node was exhausted.
349
1.83M
      if (CurSize[n] >= NewSize[n])
350
1.83M
          break;
351
1.83M
    }
352
1.83M
  }
353
1.22M
354
1.22M
  if (Nodes == 0)
355
0
    return;
356
1.22M
357
1.22M
  // Move elements left.
358
3.25M
  
for (unsigned n = 0; 1.22M
n != Nodes - 1;
++n2.03M
) {
359
2.03M
    if (CurSize[n] == NewSize[n])
360
2.00M
      continue;
361
26.0k
    for (unsigned m = n + 1; m != Nodes; 
++m0
) {
362
26.0k
      int d = Node[m]->adjustFromLeftSib(CurSize[m], *Node[n], CurSize[n],
363
26.0k
                                        CurSize[n] -  NewSize[n]);
364
26.0k
      CurSize[m] += d;
365
26.0k
      CurSize[n] -= d;
366
26.0k
      // Keep going if the current node was exhausted.
367
26.0k
      if (CurSize[n] >= NewSize[n])
368
26.0k
          break;
369
26.0k
    }
370
26.0k
  }
371
1.22M
372
1.22M
#ifndef NDEBUG
373
1.22M
  for (unsigned n = 0; n != Nodes; n++)
374
1.22M
    assert(CurSize[n] == NewSize[n] && "Insufficient element shuffle");
375
1.22M
#endif
376
1.22M
}
void llvm::IntervalMapImpl::adjustSiblingSizes<llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, llvm::LiveInterval*, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> > >(llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, llvm::LiveInterval*, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> >**, unsigned int, unsigned int*, unsigned int const*)
Line
Count
Source
338
28.7k
                        unsigned CurSize[], const unsigned NewSize[]) {
339
28.7k
  // Move elements right.
340
68.3k
  for (int n = Nodes - 1; n; 
--n39.5k
) {
341
39.5k
    if (CurSize[n] == NewSize[n])
342
1.81k
      continue;
343
37.7k
    for (int m = n - 1; m != -1; 
--m0
) {
344
37.7k
      int d = Node[n]->adjustFromLeftSib(CurSize[n], *Node[m], CurSize[m],
345
37.7k
                                         NewSize[n] - CurSize[n]);
346
37.7k
      CurSize[m] -= d;
347
37.7k
      CurSize[n] += d;
348
37.7k
      // Keep going if the current node was exhausted.
349
37.7k
      if (CurSize[n] >= NewSize[n])
350
37.7k
          break;
351
37.7k
    }
352
37.7k
  }
353
28.7k
354
28.7k
  if (Nodes == 0)
355
0
    return;
356
28.7k
357
28.7k
  // Move elements left.
358
68.3k
  
for (unsigned n = 0; 28.7k
n != Nodes - 1;
++n39.5k
) {
359
39.5k
    if (CurSize[n] == NewSize[n])
360
39.0k
      continue;
361
570
    for (unsigned m = n + 1; m != Nodes; 
++m0
) {
362
570
      int d = Node[m]->adjustFromLeftSib(CurSize[m], *Node[n], CurSize[n],
363
570
                                        CurSize[n] -  NewSize[n]);
364
570
      CurSize[m] += d;
365
570
      CurSize[n] -= d;
366
570
      // Keep going if the current node was exhausted.
367
570
      if (CurSize[n] >= NewSize[n])
368
570
          break;
369
570
    }
370
570
  }
371
28.7k
372
28.7k
#ifndef NDEBUG
373
28.7k
  for (unsigned n = 0; n != Nodes; n++)
374
28.7k
    assert(CurSize[n] == NewSize[n] && "Insufficient element shuffle");
375
28.7k
#endif
376
28.7k
}
void llvm::IntervalMapImpl::adjustSiblingSizes<llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> > >(llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >**, unsigned int, unsigned int*, unsigned int const*)
Line
Count
Source
338
37.2k
                        unsigned CurSize[], const unsigned NewSize[]) {
339
37.2k
  // Move elements right.
340
91.4k
  for (int n = Nodes - 1; n; 
--n54.2k
) {
341
54.2k
    if (CurSize[n] == NewSize[n])
342
4.08k
      continue;
343
50.1k
    for (int m = n - 1; m != -1; 
--m0
) {
344
50.1k
      int d = Node[n]->adjustFromLeftSib(CurSize[n], *Node[m], CurSize[m],
345
50.1k
                                         NewSize[n] - CurSize[n]);
346
50.1k
      CurSize[m] -= d;
347
50.1k
      CurSize[n] += d;
348
50.1k
      // Keep going if the current node was exhausted.
349
50.1k
      if (CurSize[n] >= NewSize[n])
350
50.1k
          break;
351
50.1k
    }
352
50.1k
  }
353
37.2k
354
37.2k
  if (Nodes == 0)
355
0
    return;
356
37.2k
357
37.2k
  // Move elements left.
358
91.4k
  
for (unsigned n = 0; 37.2k
n != Nodes - 1;
++n54.2k
) {
359
54.2k
    if (CurSize[n] == NewSize[n])
360
52.7k
      continue;
361
1.41k
    for (unsigned m = n + 1; m != Nodes; 
++m0
) {
362
1.41k
      int d = Node[m]->adjustFromLeftSib(CurSize[m], *Node[n], CurSize[n],
363
1.41k
                                        CurSize[n] -  NewSize[n]);
364
1.41k
      CurSize[m] += d;
365
1.41k
      CurSize[n] -= d;
366
1.41k
      // Keep going if the current node was exhausted.
367
1.41k
      if (CurSize[n] >= NewSize[n])
368
1.41k
          break;
369
1.41k
    }
370
1.41k
  }
371
37.2k
372
37.2k
#ifndef NDEBUG
373
37.2k
  for (unsigned n = 0; n != Nodes; n++)
374
37.2k
    assert(CurSize[n] == NewSize[n] && "Insufficient element shuffle");
375
37.2k
#endif
376
37.2k
}
void llvm::IntervalMapImpl::adjustSiblingSizes<llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, unsigned int, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> > >(llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, unsigned int, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> >**, unsigned int, unsigned int*, unsigned int const*)
Line
Count
Source
338
277
                        unsigned CurSize[], const unsigned NewSize[]) {
339
277
  // Move elements right.
340
644
  for (int n = Nodes - 1; n; 
--n367
) {
341
367
    if (CurSize[n] == NewSize[n])
342
12
      continue;
343
355
    for (int m = n - 1; m != -1; 
--m0
) {
344
355
      int d = Node[n]->adjustFromLeftSib(CurSize[n], *Node[m], CurSize[m],
345
355
                                         NewSize[n] - CurSize[n]);
346
355
      CurSize[m] -= d;
347
355
      CurSize[n] += d;
348
355
      // Keep going if the current node was exhausted.
349
355
      if (CurSize[n] >= NewSize[n])
350
355
          break;
351
355
    }
352
355
  }
353
277
354
277
  if (Nodes == 0)
355
0
    return;
356
277
357
277
  // Move elements left.
358
644
  
for (unsigned n = 0; 277
n != Nodes - 1;
++n367
) {
359
367
    if (CurSize[n] == NewSize[n])
360
361
      continue;
361
6
    for (unsigned m = n + 1; m != Nodes; 
++m0
) {
362
6
      int d = Node[m]->adjustFromLeftSib(CurSize[m], *Node[n], CurSize[n],
363
6
                                        CurSize[n] -  NewSize[n]);
364
6
      CurSize[m] += d;
365
6
      CurSize[n] -= d;
366
6
      // Keep going if the current node was exhausted.
367
6
      if (CurSize[n] >= NewSize[n])
368
6
          break;
369
6
    }
370
6
  }
371
277
372
277
#ifndef NDEBUG
373
277
  for (unsigned n = 0; n != Nodes; n++)
374
277
    assert(CurSize[n] == NewSize[n] && "Insufficient element shuffle");
375
277
#endif
376
277
}
DAGCombiner.cpp:void llvm::IntervalMapImpl::adjustSiblingSizes<llvm::IntervalMapImpl::LeafNode<long long, (anonymous namespace)::UnitT, 11u, llvm::IntervalMapHalfOpenInfo<long long> > >(llvm::IntervalMapImpl::LeafNode<long long, (anonymous namespace)::UnitT, 11u, llvm::IntervalMapHalfOpenInfo<long long> >**, unsigned int, unsigned int*, unsigned int const*)
Line
Count
Source
338
196
                        unsigned CurSize[], const unsigned NewSize[]) {
339
196
  // Move elements right.
340
436
  for (int n = Nodes - 1; n; 
--n240
) {
341
240
    if (CurSize[n] == NewSize[n])
342
0
      continue;
343
240
    for (int m = n - 1; m != -1; 
--m0
) {
344
240
      int d = Node[n]->adjustFromLeftSib(CurSize[n], *Node[m], CurSize[m],
345
240
                                         NewSize[n] - CurSize[n]);
346
240
      CurSize[m] -= d;
347
240
      CurSize[n] += d;
348
240
      // Keep going if the current node was exhausted.
349
240
      if (CurSize[n] >= NewSize[n])
350
240
          break;
351
240
    }
352
240
  }
353
196
354
196
  if (Nodes == 0)
355
0
    return;
356
196
357
196
  // Move elements left.
358
436
  
for (unsigned n = 0; 196
n != Nodes - 1;
++n240
) {
359
240
    if (CurSize[n] == NewSize[n])
360
240
      continue;
361
0
    for (unsigned m = n + 1; m != Nodes; ++m) {
362
0
      int d = Node[m]->adjustFromLeftSib(CurSize[m], *Node[n], CurSize[n],
363
0
                                        CurSize[n] -  NewSize[n]);
364
0
      CurSize[m] += d;
365
0
      CurSize[n] -= d;
366
0
      // Keep going if the current node was exhausted.
367
0
      if (CurSize[n] >= NewSize[n])
368
0
          break;
369
0
    }
370
0
  }
371
196
372
196
#ifndef NDEBUG
373
196
  for (unsigned n = 0; n != Nodes; n++)
374
196
    assert(CurSize[n] == NewSize[n] && "Insufficient element shuffle");
375
196
#endif
376
196
}
Unexecuted instantiation: DAGCombiner.cpp:void llvm::IntervalMapImpl::adjustSiblingSizes<llvm::IntervalMapImpl::BranchNode<long long, (anonymous namespace)::UnitT, 12u, llvm::IntervalMapHalfOpenInfo<long long> > >(llvm::IntervalMapImpl::BranchNode<long long, (anonymous namespace)::UnitT, 12u, llvm::IntervalMapHalfOpenInfo<long long> >**, unsigned int, unsigned int*, unsigned int const*)
377
378
/// IntervalMapImpl::distribute - Compute a new distribution of node elements
379
/// after an overflow or underflow. Reserve space for a new element at Position,
380
/// and compute the node that will hold Position after redistributing node
381
/// elements.
382
///
383
/// It is required that
384
///
385
///   Elements == sum(CurSize), and
386
///   Elements + Grow <= Nodes * Capacity.
387
///
388
/// NewSize[] will be filled in such that:
389
///
390
///   sum(NewSize) == Elements, and
391
///   NewSize[i] <= Capacity.
392
///
393
/// The returned index is the node where Position will go, so:
394
///
395
///   sum(NewSize[0..idx-1]) <= Position
396
///   sum(NewSize[0..idx])   >= Position
397
///
398
/// The last equality, sum(NewSize[0..idx]) == Position, can only happen when
399
/// Grow is set and NewSize[idx] == Capacity-1. The index points to the node
400
/// before the one holding the Position'th element where there is room for an
401
/// insertion.
402
///
403
/// @param Nodes    The number of nodes.
404
/// @param Elements Total elements in all nodes.
405
/// @param Capacity The capacity of each node.
406
/// @param CurSize  Array[Nodes] of current node sizes, or NULL.
407
/// @param NewSize  Array[Nodes] to receive the new node sizes.
408
/// @param Position Insert position.
409
/// @param Grow     Reserve space for a new element at Position.
410
/// @return         (node, offset) for Position.
411
IdxPair distribute(unsigned Nodes, unsigned Elements, unsigned Capacity,
412
                   const unsigned *CurSize, unsigned NewSize[],
413
                   unsigned Position, bool Grow);
414
415
//===----------------------------------------------------------------------===//
416
//---                   IntervalMapImpl::NodeSizer                         ---//
417
//===----------------------------------------------------------------------===//
418
//
419
// Compute node sizes from key and value types.
420
//
421
// The branching factors are chosen to make nodes fit in three cache lines.
422
// This may not be possible if keys or values are very large. Such large objects
423
// are handled correctly, but a std::map would probably give better performance.
424
//
425
//===----------------------------------------------------------------------===//
426
427
enum {
428
  // Cache line size. Most architectures have 32 or 64 byte cache lines.
429
  // We use 64 bytes here because it provides good branching factors.
430
  Log2CacheLine = 6,
431
  CacheLineBytes = 1 << Log2CacheLine,
432
  DesiredNodeBytes = 3 * CacheLineBytes
433
};
434
435
template <typename KeyT, typename ValT>
436
struct NodeSizer {
437
  enum {
438
    // Compute the leaf node branching factor that makes a node fit in three
439
    // cache lines. The branching factor must be at least 3, or some B+-tree
440
    // balancing algorithms won't work.
441
    // LeafSize can't be larger than CacheLineBytes. This is required by the
442
    // PointerIntPair used by NodeRef.
443
    DesiredLeafSize = DesiredNodeBytes /
444
      static_cast<unsigned>(2*sizeof(KeyT)+sizeof(ValT)),
445
    MinLeafSize = 3,
446
    LeafSize = DesiredLeafSize > MinLeafSize ? DesiredLeafSize : MinLeafSize
447
  };
448
449
  using LeafBase = NodeBase<std::pair<KeyT, KeyT>, ValT, LeafSize>;
450
451
  enum {
452
    // Now that we have the leaf branching factor, compute the actual allocation
453
    // unit size by rounding up to a whole number of cache lines.
454
    AllocBytes = (sizeof(LeafBase) + CacheLineBytes-1) & ~(CacheLineBytes-1),
455
456
    // Determine the branching factor for branch nodes.
457
    BranchSize = AllocBytes /
458
      static_cast<unsigned>(sizeof(KeyT) + sizeof(void*))
459
  };
460
461
  /// Allocator - The recycling allocator used for both branch and leaf nodes.
462
  /// This typedef is very likely to be identical for all IntervalMaps with
463
  /// reasonably sized entries, so the same allocator can be shared among
464
  /// different kinds of maps.
465
  using Allocator =
466
      RecyclingAllocator<BumpPtrAllocator, char, AllocBytes, CacheLineBytes>;
467
};
468
469
//===----------------------------------------------------------------------===//
470
//---                     IntervalMapImpl::NodeRef                         ---//
471
//===----------------------------------------------------------------------===//
472
//
473
// B+-tree nodes can be leaves or branches, so we need a polymorphic node
474
// pointer that can point to both kinds.
475
//
476
// All nodes are cache line aligned and the low 6 bits of a node pointer are
477
// always 0. These bits are used to store the number of elements in the
478
// referenced node. Besides saving space, placing node sizes in the parents
479
// allow tree balancing algorithms to run without faulting cache lines for nodes
480
// that may not need to be modified.
481
//
482
// A NodeRef doesn't know whether it references a leaf node or a branch node.
483
// It is the responsibility of the caller to use the correct types.
484
//
485
// Nodes are never supposed to be empty, and it is invalid to store a node size
486
// of 0 in a NodeRef. The valid range of sizes is 1-64.
487
//
488
//===----------------------------------------------------------------------===//
489
490
0
class NodeRef {
Unexecuted instantiation: llvm::IntervalMapImpl::NodeRef::operator=(llvm::IntervalMapImpl::NodeRef&&)
Unexecuted instantiation: llvm::IntervalMapImpl::NodeRef::operator=(llvm::IntervalMapImpl::NodeRef const&)
491
  struct CacheAlignedPointerTraits {
492
1.10M
    static inline void *getAsVoidPointer(void *P) { return P; }
493
97.2M
    static inline void *getFromVoidPointer(void *P) { return P; }
494
    enum { NumLowBitsAvailable = Log2CacheLine };
495
  };
496
  PointerIntPair<void*, Log2CacheLine, unsigned, CacheAlignedPointerTraits> pip;
497
498
public:
499
  /// NodeRef - Create a null ref.
500
5.48M
  NodeRef() = default;
501
502
  /// operator bool - Detect a null ref.
503
4.28M
  explicit operator bool() const { return pip.getOpaqueValue(); }
504
505
  /// NodeRef - Create a reference to the node p with n elements.
506
  template <typename NodeT>
507
1.10M
  NodeRef(NodeT *p, unsigned n) : pip(p, n - 1) {
508
1.10M
    assert(n <= NodeT::Capacity && "Size too big for node");
509
1.10M
  }
Unexecuted instantiation: llvm::IntervalMapImpl::NodeRef::NodeRef<llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, DbgValueLocation, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> > >(llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, DbgValueLocation, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> >*, unsigned int)
llvm::IntervalMapImpl::NodeRef::NodeRef<llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, DbgValueLocation, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> > >(llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, DbgValueLocation, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >*, unsigned int)
Line
Count
Source
507
5
  NodeRef(NodeT *p, unsigned n) : pip(p, n - 1) {
508
5
    assert(n <= NodeT::Capacity && "Size too big for node");
509
5
  }
llvm::IntervalMapImpl::NodeRef::NodeRef<llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, llvm::LiveInterval*, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> > >(llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, llvm::LiveInterval*, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> >*, unsigned int)
Line
Count
Source
507
19.6k
  NodeRef(NodeT *p, unsigned n) : pip(p, n - 1) {
508
19.6k
    assert(n <= NodeT::Capacity && "Size too big for node");
509
19.6k
  }
llvm::IntervalMapImpl::NodeRef::NodeRef<llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> > >(llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >*, unsigned int)
Line
Count
Source
507
1.04M
  NodeRef(NodeT *p, unsigned n) : pip(p, n - 1) {
508
1.04M
    assert(n <= NodeT::Capacity && "Size too big for node");
509
1.04M
  }
llvm::IntervalMapImpl::NodeRef::NodeRef<llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, unsigned int, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> > >(llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, unsigned int, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> >*, unsigned int)
Line
Count
Source
507
210
  NodeRef(NodeT *p, unsigned n) : pip(p, n - 1) {
508
210
    assert(n <= NodeT::Capacity && "Size too big for node");
509
210
  }
llvm::IntervalMapImpl::NodeRef::NodeRef<llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> > >(llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >*, unsigned int)
Line
Count
Source
507
42.2k
  NodeRef(NodeT *p, unsigned n) : pip(p, n - 1) {
508
42.2k
    assert(n <= NodeT::Capacity && "Size too big for node");
509
42.2k
  }
Unexecuted instantiation: DAGCombiner.cpp:llvm::IntervalMapImpl::NodeRef::NodeRef<llvm::IntervalMapImpl::BranchNode<long long, (anonymous namespace)::UnitT, 12u, llvm::IntervalMapHalfOpenInfo<long long> > >(llvm::IntervalMapImpl::BranchNode<long long, (anonymous namespace)::UnitT, 12u, llvm::IntervalMapHalfOpenInfo<long long> >*, unsigned int)
DAGCombiner.cpp:llvm::IntervalMapImpl::NodeRef::NodeRef<llvm::IntervalMapImpl::LeafNode<long long, (anonymous namespace)::UnitT, 11u, llvm::IntervalMapHalfOpenInfo<long long> > >(llvm::IntervalMapImpl::LeafNode<long long, (anonymous namespace)::UnitT, 11u, llvm::IntervalMapHalfOpenInfo<long long> >*, unsigned int)
Line
Count
Source
507
176
  NodeRef(NodeT *p, unsigned n) : pip(p, n - 1) {
508
176
    assert(n <= NodeT::Capacity && "Size too big for node");
509
176
  }
510
511
  /// size - Return the number of elements in the referenced node.
512
56.1M
  unsigned size() const { return pip.getInt() + 1; }
513
514
  /// setSize - Update the node size.
515
9.17M
  void setSize(unsigned n) { pip.setInt(n - 1); }
516
517
  /// subtree - Access the i'th subtree reference in a branch node.
518
  /// This depends on branch nodes storing the NodeRef array as their first
519
  /// member.
520
54.5M
  NodeRef &subtree(unsigned i) const {
521
54.5M
    return reinterpret_cast<NodeRef*>(pip.getPointer())[i];
522
54.5M
  }
523
524
  /// get - Dereference as a NodeT reference.
525
  template <typename NodeT>
526
42.6M
  NodeT &get() const {
527
42.6M
    return *reinterpret_cast<NodeT*>(pip.getPointer());
528
42.6M
  }
llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, llvm::LiveInterval*, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> >& llvm::IntervalMapImpl::NodeRef::get<llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, llvm::LiveInterval*, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> > >() const
Line
Count
Source
526
3.92M
  NodeT &get() const {
527
3.92M
    return *reinterpret_cast<NodeT*>(pip.getPointer());
528
3.92M
  }
llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >& llvm::IntervalMapImpl::NodeRef::get<llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> > >() const
Line
Count
Source
526
37.3M
  NodeT &get() const {
527
37.3M
    return *reinterpret_cast<NodeT*>(pip.getPointer());
528
37.3M
  }
Unexecuted instantiation: llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, DbgValueLocation, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> >& llvm::IntervalMapImpl::NodeRef::get<llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, DbgValueLocation, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> > >() const
llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, DbgValueLocation, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >& llvm::IntervalMapImpl::NodeRef::get<llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, DbgValueLocation, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> > >() const
Line
Count
Source
526
99
  NodeT &get() const {
527
99
    return *reinterpret_cast<NodeT*>(pip.getPointer());
528
99
  }
llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, unsigned int, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> >& llvm::IntervalMapImpl::NodeRef::get<llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, unsigned int, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> > >() const
Line
Count
Source
526
45.5k
  NodeT &get() const {
527
45.5k
    return *reinterpret_cast<NodeT*>(pip.getPointer());
528
45.5k
  }
llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >& llvm::IntervalMapImpl::NodeRef::get<llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> > >() const
Line
Count
Source
526
1.31M
  NodeT &get() const {
527
1.31M
    return *reinterpret_cast<NodeT*>(pip.getPointer());
528
1.31M
  }
DAGCombiner.cpp:llvm::IntervalMapImpl::LeafNode<long long, (anonymous namespace)::UnitT, 11u, llvm::IntervalMapHalfOpenInfo<long long> >& llvm::IntervalMapImpl::NodeRef::get<llvm::IntervalMapImpl::LeafNode<long long, (anonymous namespace)::UnitT, 11u, llvm::IntervalMapHalfOpenInfo<long long> > >() const
Line
Count
Source
526
2.72k
  NodeT &get() const {
527
2.72k
    return *reinterpret_cast<NodeT*>(pip.getPointer());
528
2.72k
  }
Unexecuted instantiation: DAGCombiner.cpp:llvm::IntervalMapImpl::BranchNode<long long, (anonymous namespace)::UnitT, 12u, llvm::IntervalMapHalfOpenInfo<long long> >& llvm::IntervalMapImpl::NodeRef::get<llvm::IntervalMapImpl::BranchNode<long long, (anonymous namespace)::UnitT, 12u, llvm::IntervalMapHalfOpenInfo<long long> > >() const
529
530
0
  bool operator==(const NodeRef &RHS) const {
531
0
    if (pip == RHS.pip)
532
0
      return true;
533
0
    assert(pip.getPointer() != RHS.pip.getPointer() && "Inconsistent NodeRefs");
534
0
    return false;
535
0
  }
536
537
0
  bool operator!=(const NodeRef &RHS) const {
538
0
    return !operator==(RHS);
539
0
  }
540
};
541
542
//===----------------------------------------------------------------------===//
543
//---                      IntervalMapImpl::LeafNode                       ---//
544
//===----------------------------------------------------------------------===//
545
//
546
// Leaf nodes store up to N disjoint intervals with corresponding values.
547
//
548
// The intervals are kept sorted and fully coalesced so there are no adjacent
549
// intervals mapping to the same value.
550
//
551
// These constraints are always satisfied:
552
//
553
// - Traits::stopLess(start(i), stop(i))    - Non-empty, sane intervals.
554
//
555
// - Traits::stopLess(stop(i), start(i + 1) - Sorted.
556
//
557
// - value(i) != value(i + 1) || !Traits::adjacent(stop(i), start(i + 1))
558
//                                          - Fully coalesced.
559
//
560
//===----------------------------------------------------------------------===//
561
562
template <typename KeyT, typename ValT, unsigned N, typename Traits>
563
class LeafNode : public NodeBase<std::pair<KeyT, KeyT>, ValT, N> {
564
public:
565
2.88M
  const KeyT &start(unsigned i) const { return this->first[i].first; }
Unexecuted instantiation: llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::start(unsigned int) const
llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::start(unsigned int) const
Line
Count
Source
565
2.88M
  const KeyT &start(unsigned i) const { return this->first[i].first; }
566
402M
  const KeyT &stop(unsigned i) const { return this->first[i].second; }
llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::stop(unsigned int) const
Line
Count
Source
566
387M
  const KeyT &stop(unsigned i) const { return this->first[i].second; }
llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, DbgValueLocation, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::stop(unsigned int) const
Line
Count
Source
566
351
  const KeyT &stop(unsigned i) const { return this->first[i].second; }
llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::stop(unsigned int) const
Line
Count
Source
566
14.7k
  const KeyT &stop(unsigned i) const { return this->first[i].second; }
llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::stop(unsigned int) const
Line
Count
Source
566
14.1M
  const KeyT &stop(unsigned i) const { return this->first[i].second; }
DAGCombiner.cpp:llvm::IntervalMapImpl::LeafNode<long long, (anonymous namespace)::UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::stop(unsigned int) const
Line
Count
Source
566
478k
  const KeyT &stop(unsigned i) const { return this->first[i].second; }
DAGCombiner.cpp:llvm::IntervalMapImpl::LeafNode<long long, (anonymous namespace)::UnitT, 11u, llvm::IntervalMapHalfOpenInfo<long long> >::stop(unsigned int) const
Line
Count
Source
566
2.21k
  const KeyT &stop(unsigned i) const { return this->first[i].second; }
567
1.27M
  const ValT &value(unsigned i) const { return this->second[i]; }
568
569
386M
  KeyT &start(unsigned i) { return this->first[i].first; }
llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::start(unsigned int)
Line
Count
Source
569
377M
  KeyT &start(unsigned i) { return this->first[i].first; }
llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, DbgValueLocation, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::start(unsigned int)
Line
Count
Source
569
226
  KeyT &start(unsigned i) { return this->first[i].first; }
llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::start(unsigned int)
Line
Count
Source
569
37.9k
  KeyT &start(unsigned i) { return this->first[i].first; }
llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::start(unsigned int)
Line
Count
Source
569
5.27M
  KeyT &start(unsigned i) { return this->first[i].first; }
DAGCombiner.cpp:llvm::IntervalMapImpl::LeafNode<long long, (anonymous namespace)::UnitT, 11u, llvm::IntervalMapHalfOpenInfo<long long> >::start(unsigned int)
Line
Count
Source
569
4.98k
  KeyT &start(unsigned i) { return this->first[i].first; }
DAGCombiner.cpp:llvm::IntervalMapImpl::LeafNode<long long, (anonymous namespace)::UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::start(unsigned int)
Line
Count
Source
569
3.67M
  KeyT &start(unsigned i) { return this->first[i].first; }
570
324M
  KeyT &stop(unsigned i) { return this->first[i].second; }
llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::stop(unsigned int)
Line
Count
Source
570
314M
  KeyT &stop(unsigned i) { return this->first[i].second; }
llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, DbgValueLocation, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::stop(unsigned int)
Line
Count
Source
570
166
  KeyT &stop(unsigned i) { return this->first[i].second; }
llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::stop(unsigned int)
Line
Count
Source
570
23.7k
  KeyT &stop(unsigned i) { return this->first[i].second; }
llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::stop(unsigned int)
Line
Count
Source
570
6.74M
  KeyT &stop(unsigned i) { return this->first[i].second; }
DAGCombiner.cpp:llvm::IntervalMapImpl::LeafNode<long long, (anonymous namespace)::UnitT, 11u, llvm::IntervalMapHalfOpenInfo<long long> >::stop(unsigned int)
Line
Count
Source
570
1.24k
  KeyT &stop(unsigned i) { return this->first[i].second; }
DAGCombiner.cpp:llvm::IntervalMapImpl::LeafNode<long long, (anonymous namespace)::UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::stop(unsigned int)
Line
Count
Source
570
3.04M
  KeyT &stop(unsigned i) { return this->first[i].second; }
571
224M
  ValT &value(unsigned i) { return this->second[i]; }
llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, DbgValueLocation, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::value(unsigned int)
Line
Count
Source
571
323
  ValT &value(unsigned i) { return this->second[i]; }
llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::value(unsigned int)
Line
Count
Source
571
38.9k
  ValT &value(unsigned i) { return this->second[i]; }
llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::value(unsigned int)
Line
Count
Source
571
214M
  ValT &value(unsigned i) { return this->second[i]; }
llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::value(unsigned int)
Line
Count
Source
571
6.51M
  ValT &value(unsigned i) { return this->second[i]; }
DAGCombiner.cpp:llvm::IntervalMapImpl::LeafNode<long long, (anonymous namespace)::UnitT, 11u, llvm::IntervalMapHalfOpenInfo<long long> >::value(unsigned int)
Line
Count
Source
571
2.10k
  ValT &value(unsigned i) { return this->second[i]; }
DAGCombiner.cpp:llvm::IntervalMapImpl::LeafNode<long long, (anonymous namespace)::UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::value(unsigned int)
Line
Count
Source
571
3.24M
  ValT &value(unsigned i) { return this->second[i]; }
572
573
  /// findFrom - Find the first interval after i that may contain x.
574
  /// @param i    Starting index for the search.
575
  /// @param Size Number of elements in node.
576
  /// @param x    Key to search for.
577
  /// @return     First index with !stopLess(key[i].stop, x), or size.
578
  ///             This is the first interval that can possibly contain x.
579
143M
  unsigned findFrom(unsigned i, unsigned Size, KeyT x) const {
580
143M
    assert(i <= Size && Size <= N && "Bad indices");
581
143M
    assert((i == 0 || Traits::stopLess(stop(i - 1), x)) &&
582
143M
           "Index is past the needed point");
583
245M
    while (i != Size && 
Traits::stopLess(stop(i), x)226M
)
++i102M
;
584
143M
    return i;
585
143M
  }
llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::findFrom(unsigned int, unsigned int, llvm::SlotIndex) const
Line
Count
Source
579
137M
  unsigned findFrom(unsigned i, unsigned Size, KeyT x) const {
580
137M
    assert(i <= Size && Size <= N && "Bad indices");
581
137M
    assert((i == 0 || Traits::stopLess(stop(i - 1), x)) &&
582
137M
           "Index is past the needed point");
583
234M
    while (i != Size && 
Traits::stopLess(stop(i), x)219M
)
++i97.1M
;
584
137M
    return i;
585
137M
  }
llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::findFrom(unsigned int, unsigned int, llvm::SlotIndex) const
Line
Count
Source
579
18.6k
  unsigned findFrom(unsigned i, unsigned Size, KeyT x) const {
580
18.6k
    assert(i <= Size && Size <= N && "Bad indices");
581
18.6k
    assert((i == 0 || Traits::stopLess(stop(i - 1), x)) &&
582
18.6k
           "Index is past the needed point");
583
24.1k
    while (i != Size && 
Traits::stopLess(stop(i), x)14.7k
)
++i5.50k
;
584
18.6k
    return i;
585
18.6k
  }
llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::findFrom(unsigned int, unsigned int, llvm::SlotIndex) const
Line
Count
Source
579
2.44M
  unsigned findFrom(unsigned i, unsigned Size, KeyT x) const {
580
2.44M
    assert(i <= Size && Size <= N && "Bad indices");
581
2.44M
    assert((i == 0 || Traits::stopLess(stop(i - 1), x)) &&
582
2.44M
           "Index is past the needed point");
583
7.34M
    while (i != Size && 
Traits::stopLess(stop(i), x)6.68M
)
++i4.90M
;
584
2.44M
    return i;
585
2.44M
  }
DAGCombiner.cpp:llvm::IntervalMapImpl::LeafNode<long long, (anonymous namespace)::UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::findFrom(unsigned int, unsigned int, long long) const
Line
Count
Source
579
3.47M
  unsigned findFrom(unsigned i, unsigned Size, KeyT x) const {
580
3.47M
    assert(i <= Size && Size <= N && "Bad indices");
581
3.47M
    assert((i == 0 || Traits::stopLess(stop(i - 1), x)) &&
582
3.47M
           "Index is past the needed point");
583
3.49M
    while (i != Size && 
Traits::stopLess(stop(i), x)478k
)
++i28.2k
;
584
3.47M
    return i;
585
3.47M
  }
586
587
  /// safeFind - Find an interval that is known to exist. This is the same as
588
  /// findFrom except is it assumed that x is at least within range of the last
589
  /// interval.
590
  /// @param i Starting index for the search.
591
  /// @param x Key to search for.
592
  /// @return  First index with !stopLess(key[i].stop, x), never size.
593
  ///          This is the first interval that can possibly contain x.
594
47.2M
  unsigned safeFind(unsigned i, KeyT x) const {
595
47.2M
    assert(i < N && "Bad index");
596
47.2M
    assert((i == 0 || Traits::stopLess(stop(i - 1), x)) &&
597
47.2M
           "Index is past the needed point");
598
174M
    while (Traits::stopLess(stop(i), x)) 
++i127M
;
599
47.2M
    assert(i < N && "Unsafe intervals");
600
47.2M
    return i;
601
47.2M
  }
llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::safeFind(unsigned int, llvm::SlotIndex) const
Line
Count
Source
594
44.8M
  unsigned safeFind(unsigned i, KeyT x) const {
595
44.8M
    assert(i < N && "Bad index");
596
44.8M
    assert((i == 0 || Traits::stopLess(stop(i - 1), x)) &&
597
44.8M
           "Index is past the needed point");
598
168M
    while (Traits::stopLess(stop(i), x)) 
++i123M
;
599
44.8M
    assert(i < N && "Unsafe intervals");
600
44.8M
    return i;
601
44.8M
  }
llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, DbgValueLocation, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::safeFind(unsigned int, llvm::SlotIndex) const
Line
Count
Source
594
88
  unsigned safeFind(unsigned i, KeyT x) const {
595
88
    assert(i < N && "Bad index");
596
88
    assert((i == 0 || Traits::stopLess(stop(i - 1), x)) &&
597
88
           "Index is past the needed point");
598
351
    while (Traits::stopLess(stop(i), x)) 
++i263
;
599
88
    assert(i < N && "Unsafe intervals");
600
88
    return i;
601
88
  }
llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::safeFind(unsigned int, llvm::SlotIndex) const
Line
Count
Source
594
2.34M
  unsigned safeFind(unsigned i, KeyT x) const {
595
2.34M
    assert(i < N && "Bad index");
596
2.34M
    assert((i == 0 || Traits::stopLess(stop(i - 1), x)) &&
597
2.34M
           "Index is past the needed point");
598
6.19M
    while (Traits::stopLess(stop(i), x)) 
++i3.85M
;
599
2.34M
    assert(i < N && "Unsafe intervals");
600
2.34M
    return i;
601
2.34M
  }
DAGCombiner.cpp:llvm::IntervalMapImpl::LeafNode<long long, (anonymous namespace)::UnitT, 11u, llvm::IntervalMapHalfOpenInfo<long long> >::safeFind(unsigned int, long long) const
Line
Count
Source
594
2.21k
  unsigned safeFind(unsigned i, KeyT x) const {
595
2.21k
    assert(i < N && "Bad index");
596
2.21k
    assert((i == 0 || Traits::stopLess(stop(i - 1), x)) &&
597
2.21k
           "Index is past the needed point");
598
2.21k
    while (Traits::stopLess(stop(i), x)) 
++i5
;
599
2.21k
    assert(i < N && "Unsafe intervals");
600
2.21k
    return i;
601
2.21k
  }
602
603
  /// safeLookup - Lookup mapped value for a safe key.
604
  /// It is assumed that x is within range of the last entry.
605
  /// @param x        Key to search for.
606
  /// @param NotFound Value to return if x is not in any interval.
607
  /// @return         The mapped value at x or NotFound.
608
1.47M
  ValT safeLookup(KeyT x, ValT NotFound) const {
609
1.47M
    unsigned i = safeFind(0, x);
610
1.47M
    return Traits::startLess(x, start(i)) ? 
NotFound199k
:
value(i)1.27M
;
611
1.47M
  }
612
613
  unsigned insertFrom(unsigned &Pos, unsigned Size, KeyT a, KeyT b, ValT y);
614
};
615
616
/// insertFrom - Add mapping of [a;b] to y if possible, coalescing as much as
617
/// possible. This may cause the node to grow by 1, or it may cause the node
618
/// to shrink because of coalescing.
619
/// @param Pos  Starting index = insertFrom(0, size, a)
620
/// @param Size Number of elements in node.
621
/// @param a    Interval start.
622
/// @param b    Interval stop.
623
/// @param y    Value be mapped.
624
/// @return     (insert position, new size), or (i, Capacity+1) on overflow.
625
template <typename KeyT, typename ValT, unsigned N, typename Traits>
626
unsigned LeafNode<KeyT, ValT, N, Traits>::
627
23.8M
insertFrom(unsigned &Pos, unsigned Size, KeyT a, KeyT b, ValT y) {
628
23.8M
  unsigned i = Pos;
629
23.8M
  assert(i <= Size && Size <= N && "Invalid index");
630
23.8M
  assert(!Traits::stopLess(b, a) && "Invalid interval");
631
23.8M
632
23.8M
  // Verify the findFrom invariant.
633
23.8M
  assert((i == 0 || Traits::stopLess(stop(i - 1), a)));
634
23.8M
  assert((i == Size || !Traits::stopLess(stop(i), a)));
635
23.8M
  assert((i == Size || Traits::stopLess(b, start(i))) && "Overlapping insert");
636
23.8M
637
23.8M
  // Coalesce with previous interval.
638
23.8M
  if (i && 
value(i - 1) == y14.4M
&&
Traits::adjacent(stop(i - 1), a)7.06M
) {
639
2.90M
    Pos = i - 1;
640
2.90M
    // Also coalesce with next interval?
641
2.90M
    if (i != Size && 
value(i) == y2.79M
&&
Traits::adjacent(b, start(i))1.99M
) {
642
622k
      stop(i - 1) = stop(i);
643
622k
      this->erase(i, Size);
644
622k
      return Size - 1;
645
622k
    }
646
2.28M
    stop(i - 1) = b;
647
2.28M
    return Size;
648
2.28M
  }
649
20.9M
650
20.9M
  // Detect overflow.
651
20.9M
  if (i == N)
652
369k
    return N + 1;
653
20.5M
654
20.5M
  // Add new interval at end.
655
20.5M
  if (i == Size) {
656
10.4M
    start(i) = a;
657
10.4M
    stop(i) = b;
658
10.4M
    value(i) = y;
659
10.4M
    return Size + 1;
660
10.4M
  }
661
10.1M
662
10.1M
  // Try to coalesce with following interval.
663
10.1M
  if (value(i) == y && 
Traits::adjacent(b, start(i))4.91M
) {
664
921k
    start(i) = a;
665
921k
    return Size;
666
921k
  }
667
9.18M
668
9.18M
  // We must insert before i. Detect overflow.
669
9.18M
  if (Size == N)
670
1.21M
    return N + 1;
671
7.97M
672
7.97M
  // Insert before i.
673
7.97M
  this->shift(i, Size);
674
7.97M
  start(i) = a;
675
7.97M
  stop(i) = b;
676
7.97M
  value(i) = y;
677
7.97M
  return Size + 1;
678
7.97M
}
llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, DbgValueLocation, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::insertFrom(unsigned int&, unsigned int, llvm::SlotIndex, llvm::SlotIndex, DbgValueLocation)
Line
Count
Source
627
47
insertFrom(unsigned &Pos, unsigned Size, KeyT a, KeyT b, ValT y) {
628
47
  unsigned i = Pos;
629
47
  assert(i <= Size && Size <= N && "Invalid index");
630
47
  assert(!Traits::stopLess(b, a) && "Invalid interval");
631
47
632
47
  // Verify the findFrom invariant.
633
47
  assert((i == 0 || Traits::stopLess(stop(i - 1), a)));
634
47
  assert((i == Size || !Traits::stopLess(stop(i), a)));
635
47
  assert((i == Size || Traits::stopLess(b, start(i))) && "Overlapping insert");
636
47
637
47
  // Coalesce with previous interval.
638
47
  if (i && value(i - 1) == y && 
Traits::adjacent(stop(i - 1), a)36
) {
639
31
    Pos = i - 1;
640
31
    // Also coalesce with next interval?
641
31
    if (i != Size && 
value(i) == y25
&&
Traits::adjacent(b, start(i))11
) {
642
3
      stop(i - 1) = stop(i);
643
3
      this->erase(i, Size);
644
3
      return Size - 1;
645
3
    }
646
28
    stop(i - 1) = b;
647
28
    return Size;
648
28
  }
649
16
650
16
  // Detect overflow.
651
16
  if (i == N)
652
0
    return N + 1;
653
16
654
16
  // Add new interval at end.
655
16
  if (i == Size) {
656
10
    start(i) = a;
657
10
    stop(i) = b;
658
10
    value(i) = y;
659
10
    return Size + 1;
660
10
  }
661
6
662
6
  // Try to coalesce with following interval.
663
6
  if (value(i) == y && 
Traits::adjacent(b, start(i))2
) {
664
0
    start(i) = a;
665
0
    return Size;
666
0
  }
667
6
668
6
  // We must insert before i. Detect overflow.
669
6
  if (Size == N)
670
0
    return N + 1;
671
6
672
6
  // Insert before i.
673
6
  this->shift(i, Size);
674
6
  start(i) = a;
675
6
  stop(i) = b;
676
6
  value(i) = y;
677
6
  return Size + 1;
678
6
}
llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::insertFrom(unsigned int&, unsigned int, llvm::SlotIndex, llvm::SlotIndex, DbgValueLocation)
Line
Count
Source
627
9.47k
insertFrom(unsigned &Pos, unsigned Size, KeyT a, KeyT b, ValT y) {
628
9.47k
  unsigned i = Pos;
629
9.47k
  assert(i <= Size && Size <= N && "Invalid index");
630
9.47k
  assert(!Traits::stopLess(b, a) && "Invalid interval");
631
9.47k
632
9.47k
  // Verify the findFrom invariant.
633
9.47k
  assert((i == 0 || Traits::stopLess(stop(i - 1), a)));
634
9.47k
  assert((i == Size || !Traits::stopLess(stop(i), a)));
635
9.47k
  assert((i == Size || Traits::stopLess(b, start(i))) && "Overlapping insert");
636
9.47k
637
9.47k
  // Coalesce with previous interval.
638
9.47k
  if (i && 
value(i - 1) == y4.86k
&&
Traits::adjacent(stop(i - 1), a)4.61k
) {
639
4.57k
    Pos = i - 1;
640
4.57k
    // Also coalesce with next interval?
641
4.57k
    if (i != Size && 
value(i) == y98
&&
Traits::adjacent(b, start(i))29
) {
642
9
      stop(i - 1) = stop(i);
643
9
      this->erase(i, Size);
644
9
      return Size - 1;
645
9
    }
646
4.56k
    stop(i - 1) = b;
647
4.56k
    return Size;
648
4.56k
  }
649
4.90k
650
4.90k
  // Detect overflow.
651
4.90k
  if (i == N)
652
5
    return N + 1;
653
4.89k
654
4.89k
  // Add new interval at end.
655
4.89k
  if (i == Size) {
656
4.89k
    start(i) = a;
657
4.89k
    stop(i) = b;
658
4.89k
    value(i) = y;
659
4.89k
    return Size + 1;
660
4.89k
  }
661
9
662
9
  // Try to coalesce with following interval.
663
9
  if (value(i) == y && 
Traits::adjacent(b, start(i))0
) {
664
0
    start(i) = a;
665
0
    return Size;
666
0
  }
667
9
668
9
  // We must insert before i. Detect overflow.
669
9
  if (Size == N)
670
0
    return N + 1;
671
9
672
9
  // Insert before i.
673
9
  this->shift(i, Size);
674
9
  start(i) = a;
675
9
  stop(i) = b;
676
9
  value(i) = y;
677
9
  return Size + 1;
678
9
}
llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::insertFrom(unsigned int&, unsigned int, llvm::SlotIndex, llvm::SlotIndex, llvm::LiveInterval*)
Line
Count
Source
627
17.8M
insertFrom(unsigned &Pos, unsigned Size, KeyT a, KeyT b, ValT y) {
628
17.8M
  unsigned i = Pos;
629
17.8M
  assert(i <= Size && Size <= N && "Invalid index");
630
17.8M
  assert(!Traits::stopLess(b, a) && "Invalid interval");
631
17.8M
632
17.8M
  // Verify the findFrom invariant.
633
17.8M
  assert((i == 0 || Traits::stopLess(stop(i - 1), a)));
634
17.8M
  assert((i == Size || !Traits::stopLess(stop(i), a)));
635
17.8M
  assert((i == Size || Traits::stopLess(b, start(i))) && "Overlapping insert");
636
17.8M
637
17.8M
  // Coalesce with previous interval.
638
17.8M
  if (i && 
value(i - 1) == y12.0M
&&
Traits::adjacent(stop(i - 1), a)4.70M
) {
639
1.60M
    Pos = i - 1;
640
1.60M
    // Also coalesce with next interval?
641
1.60M
    if (i != Size && value(i) == y && 
Traits::adjacent(b, start(i))855k
) {
642
241k
      stop(i - 1) = stop(i);
643
241k
      this->erase(i, Size);
644
241k
      return Size - 1;
645
241k
    }
646
1.36M
    stop(i - 1) = b;
647
1.36M
    return Size;
648
1.36M
  }
649
16.2M
650
16.2M
  // Detect overflow.
651
16.2M
  if (i == N)
652
354k
    return N + 1;
653
15.9M
654
15.9M
  // Add new interval at end.
655
15.9M
  if (i == Size) {
656
6.85M
    start(i) = a;
657
6.85M
    stop(i) = b;
658
6.85M
    value(i) = y;
659
6.85M
    return Size + 1;
660
6.85M
  }
661
9.04M
662
9.04M
  // Try to coalesce with following interval.
663
9.04M
  if (value(i) == y && 
Traits::adjacent(b, start(i))3.89M
) {
664
420k
    start(i) = a;
665
420k
    return Size;
666
420k
  }
667
8.62M
668
8.62M
  // We must insert before i. Detect overflow.
669
8.62M
  if (Size == N)
670
1.17M
    return N + 1;
671
7.44M
672
7.44M
  // Insert before i.
673
7.44M
  this->shift(i, Size);
674
7.44M
  start(i) = a;
675
7.44M
  stop(i) = b;
676
7.44M
  value(i) = y;
677
7.44M
  return Size + 1;
678
7.44M
}
llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::insertFrom(unsigned int&, unsigned int, llvm::SlotIndex, llvm::SlotIndex, unsigned int)
Line
Count
Source
627
2.75M
insertFrom(unsigned &Pos, unsigned Size, KeyT a, KeyT b, ValT y) {
628
2.75M
  unsigned i = Pos;
629
2.75M
  assert(i <= Size && Size <= N && "Invalid index");
630
2.75M
  assert(!Traits::stopLess(b, a) && "Invalid interval");
631
2.75M
632
2.75M
  // Verify the findFrom invariant.
633
2.75M
  assert((i == 0 || Traits::stopLess(stop(i - 1), a)));
634
2.75M
  assert((i == Size || !Traits::stopLess(stop(i), a)));
635
2.75M
  assert((i == Size || Traits::stopLess(b, start(i))) && "Overlapping insert");
636
2.75M
637
2.75M
  // Coalesce with previous interval.
638
2.75M
  if (i && 
value(i - 1) == y2.47M
&&
Traits::adjacent(stop(i - 1), a)2.34M
) {
639
1.30M
    Pos = i - 1;
640
1.30M
    // Also coalesce with next interval?
641
1.30M
    if (i != Size && 
value(i) == y1.18M
&&
Traits::adjacent(b, start(i))1.14M
) {
642
380k
      stop(i - 1) = stop(i);
643
380k
      this->erase(i, Size);
644
380k
      return Size - 1;
645
380k
    }
646
921k
    stop(i - 1) = b;
647
921k
    return Size;
648
921k
  }
649
1.45M
650
1.45M
  // Detect overflow.
651
1.45M
  if (i == N)
652
15.6k
    return N + 1;
653
1.43M
654
1.43M
  // Add new interval at end.
655
1.43M
  if (i == Size) {
656
594k
    start(i) = a;
657
594k
    stop(i) = b;
658
594k
    value(i) = y;
659
594k
    return Size + 1;
660
594k
  }
661
841k
662
841k
  // Try to coalesce with following interval.
663
841k
  if (value(i) == y && 
Traits::adjacent(b, start(i))790k
) {
664
303k
    start(i) = a;
665
303k
    return Size;
666
303k
  }
667
538k
668
538k
  // We must insert before i. Detect overflow.
669
538k
  if (Size == N)
670
37.9k
    return N + 1;
671
500k
672
500k
  // Insert before i.
673
500k
  this->shift(i, Size);
674
500k
  start(i) = a;
675
500k
  stop(i) = b;
676
500k
  value(i) = y;
677
500k
  return Size + 1;
678
500k
}
DAGCombiner.cpp:llvm::IntervalMapImpl::LeafNode<long long, (anonymous namespace)::UnitT, 11u, llvm::IntervalMapHalfOpenInfo<long long> >::insertFrom(unsigned int&, unsigned int, long long, long long, (anonymous namespace)::UnitT)
Line
Count
Source
627
1.39k
insertFrom(unsigned &Pos, unsigned Size, KeyT a, KeyT b, ValT y) {
628
1.39k
  unsigned i = Pos;
629
1.39k
  assert(i <= Size && Size <= N && "Invalid index");
630
1.39k
  assert(!Traits::stopLess(b, a) && "Invalid interval");
631
1.39k
632
1.39k
  // Verify the findFrom invariant.
633
1.39k
  assert((i == 0 || Traits::stopLess(stop(i - 1), a)));
634
1.39k
  assert((i == Size || !Traits::stopLess(stop(i), a)));
635
1.39k
  assert((i == Size || Traits::stopLess(b, start(i))) && "Overlapping insert");
636
1.39k
637
1.39k
  // Coalesce with previous interval.
638
1.39k
  if (i && 
value(i - 1) == y0
&&
Traits::adjacent(stop(i - 1), a)0
) {
639
0
    Pos = i - 1;
640
0
    // Also coalesce with next interval?
641
0
    if (i != Size && value(i) == y && Traits::adjacent(b, start(i))) {
642
0
      stop(i - 1) = stop(i);
643
0
      this->erase(i, Size);
644
0
      return Size - 1;
645
0
    }
646
0
    stop(i - 1) = b;
647
0
    return Size;
648
0
  }
649
1.39k
650
1.39k
  // Detect overflow.
651
1.39k
  if (i == N)
652
0
    return N + 1;
653
1.39k
654
1.39k
  // Add new interval at end.
655
1.39k
  if (i == Size) {
656
0
    start(i) = a;
657
0
    stop(i) = b;
658
0
    value(i) = y;
659
0
    return Size + 1;
660
0
  }
661
1.39k
662
1.39k
  // Try to coalesce with following interval.
663
1.39k
  if (value(i) == y && Traits::adjacent(b, start(i))) {
664
486
    start(i) = a;
665
486
    return Size;
666
486
  }
667
908
668
908
  // We must insert before i. Detect overflow.
669
908
  if (Size == N)
670
196
    return N + 1;
671
712
672
712
  // Insert before i.
673
712
  this->shift(i, Size);
674
712
  start(i) = a;
675
712
  stop(i) = b;
676
712
  value(i) = y;
677
712
  return Size + 1;
678
712
}
DAGCombiner.cpp:llvm::IntervalMapImpl::LeafNode<long long, (anonymous namespace)::UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::insertFrom(unsigned int&, unsigned int, long long, long long, (anonymous namespace)::UnitT)
Line
Count
Source
627
3.22M
insertFrom(unsigned &Pos, unsigned Size, KeyT a, KeyT b, ValT y) {
628
3.22M
  unsigned i = Pos;
629
3.22M
  assert(i <= Size && Size <= N && "Invalid index");
630
3.22M
  assert(!Traits::stopLess(b, a) && "Invalid interval");
631
3.22M
632
3.22M
  // Verify the findFrom invariant.
633
3.22M
  assert((i == 0 || Traits::stopLess(stop(i - 1), a)));
634
3.22M
  assert((i == Size || !Traits::stopLess(stop(i), a)));
635
3.22M
  assert((i == Size || Traits::stopLess(b, start(i))) && "Overlapping insert");
636
3.22M
637
3.22M
  // Coalesce with previous interval.
638
3.22M
  if (i && 
value(i - 1) == y0
&&
Traits::adjacent(stop(i - 1), a)0
) {
639
0
    Pos = i - 1;
640
0
    // Also coalesce with next interval?
641
0
    if (i != Size && value(i) == y && Traits::adjacent(b, start(i))) {
642
0
      stop(i - 1) = stop(i);
643
0
      this->erase(i, Size);
644
0
      return Size - 1;
645
0
    }
646
0
    stop(i - 1) = b;
647
0
    return Size;
648
0
  }
649
3.22M
650
3.22M
  // Detect overflow.
651
3.22M
  if (i == N)
652
0
    return N + 1;
653
3.22M
654
3.22M
  // Add new interval at end.
655
3.22M
  if (i == Size) {
656
3.00M
    start(i) = a;
657
3.00M
    stop(i) = b;
658
3.00M
    value(i) = y;
659
3.00M
    return Size + 1;
660
3.00M
  }
661
222k
662
222k
  // Try to coalesce with following interval.
663
222k
  if (value(i) == y && Traits::adjacent(b, start(i))) {
664
197k
    start(i) = a;
665
197k
    return Size;
666
197k
  }
667
25.0k
668
25.0k
  // We must insert before i. Detect overflow.
669
25.0k
  if (Size == N)
670
92
    return N + 1;
671
24.9k
672
24.9k
  // Insert before i.
673
24.9k
  this->shift(i, Size);
674
24.9k
  start(i) = a;
675
24.9k
  stop(i) = b;
676
24.9k
  value(i) = y;
677
24.9k
  return Size + 1;
678
24.9k
}
679
680
//===----------------------------------------------------------------------===//
681
//---                   IntervalMapImpl::BranchNode                        ---//
682
//===----------------------------------------------------------------------===//
683
//
684
// A branch node stores references to 1--N subtrees all of the same height.
685
//
686
// The key array in a branch node holds the rightmost stop key of each subtree.
687
// It is redundant to store the last stop key since it can be found in the
688
// parent node, but doing so makes tree balancing a lot simpler.
689
//
690
// It is unusual for a branch node to only have one subtree, but it can happen
691
// in the root node if it is smaller than the normal nodes.
692
//
693
// When all of the leaf nodes from all the subtrees are concatenated, they must
694
// satisfy the same constraints as a single leaf node. They must be sorted,
695
// sane, and fully coalesced.
696
//
697
//===----------------------------------------------------------------------===//
698
699
template <typename KeyT, typename ValT, unsigned N, typename Traits>
700
class BranchNode : public NodeBase<NodeRef, KeyT, N> {
701
public:
702
110M
  const KeyT &stop(unsigned i) const { return this->second[i]; }
llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, llvm::LiveInterval*, 11u, llvm::IntervalMapInfo<llvm::SlotIndex> >::stop(unsigned int) const
Line
Count
Source
702
84.5M
  const KeyT &stop(unsigned i) const { return this->second[i]; }
llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, llvm::LiveInterval*, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> >::stop(unsigned int) const
Line
Count
Source
702
23.1M
  const KeyT &stop(unsigned i) const { return this->second[i]; }
llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::stop(unsigned int) const
Line
Count
Source
702
95
  const KeyT &stop(unsigned i) const { return this->second[i]; }
Unexecuted instantiation: llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, DbgValueLocation, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> >::stop(unsigned int) const
llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, unsigned int, 11u, llvm::IntervalMapInfo<llvm::SlotIndex> >::stop(unsigned int) const
Line
Count
Source
702
2.87M
  const KeyT &stop(unsigned i) const { return this->second[i]; }
llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, unsigned int, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> >::stop(unsigned int) const
Line
Count
Source
702
238k
  const KeyT &stop(unsigned i) const { return this->second[i]; }
DAGCombiner.cpp:llvm::IntervalMapImpl::BranchNode<long long, (anonymous namespace)::UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::stop(unsigned int) const
Line
Count
Source
702
2.22k
  const KeyT &stop(unsigned i) const { return this->second[i]; }
Unexecuted instantiation: DAGCombiner.cpp:llvm::IntervalMapImpl::BranchNode<long long, (anonymous namespace)::UnitT, 12u, llvm::IntervalMapHalfOpenInfo<long long> >::stop(unsigned int) const
703
384k
  const NodeRef &subtree(unsigned i) const { return this->first[i]; }
llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, unsigned int, 11u, llvm::IntervalMapInfo<llvm::SlotIndex> >::subtree(unsigned int) const
Line
Count
Source
703
364k
  const NodeRef &subtree(unsigned i) const { return this->first[i]; }
llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, unsigned int, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> >::subtree(unsigned int) const
Line
Count
Source
703
19.8k
  const NodeRef &subtree(unsigned i) const { return this->first[i]; }
704
705
6.78M
  KeyT &stop(unsigned i) { return this->second[i]; }
llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, llvm::LiveInterval*, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> >::stop(unsigned int)
Line
Count
Source
705
1.27M
  KeyT &stop(unsigned i) { return this->second[i]; }
llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, llvm::LiveInterval*, 11u, llvm::IntervalMapInfo<llvm::SlotIndex> >::stop(unsigned int)
Line
Count
Source
705
5.27M
  KeyT &stop(unsigned i) { return this->second[i]; }
Unexecuted instantiation: llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, DbgValueLocation, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> >::stop(unsigned int)
llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::stop(unsigned int)
Line
Count
Source
705
21
  KeyT &stop(unsigned i) { return this->second[i]; }
llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, unsigned int, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> >::stop(unsigned int)
Line
Count
Source
705
13.8k
  KeyT &stop(unsigned i) { return this->second[i]; }
llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, unsigned int, 11u, llvm::IntervalMapInfo<llvm::SlotIndex> >::stop(unsigned int)
Line
Count
Source
705
221k
  KeyT &stop(unsigned i) { return this->second[i]; }
Unexecuted instantiation: DAGCombiner.cpp:llvm::IntervalMapImpl::BranchNode<long long, (anonymous namespace)::UnitT, 12u, llvm::IntervalMapHalfOpenInfo<long long> >::stop(unsigned int)
DAGCombiner.cpp:llvm::IntervalMapImpl::BranchNode<long long, (anonymous namespace)::UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::stop(unsigned int)
Line
Count
Source
705
528
  KeyT &stop(unsigned i) { return this->second[i]; }
706
1.98M
  NodeRef &subtree(unsigned i) { return this->first[i]; }
llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::subtree(unsigned int)
Line
Count
Source
706
10
  NodeRef &subtree(unsigned i) { return this->first[i]; }
Unexecuted instantiation: llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, DbgValueLocation, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> >::subtree(unsigned int)
llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, llvm::LiveInterval*, 11u, llvm::IntervalMapInfo<llvm::SlotIndex> >::subtree(unsigned int)
Line
Count
Source
706
1.79M
  NodeRef &subtree(unsigned i) { return this->first[i]; }
llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, llvm::LiveInterval*, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> >::subtree(unsigned int)
Line
Count
Source
706
105k
  NodeRef &subtree(unsigned i) { return this->first[i]; }
llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, unsigned int, 11u, llvm::IntervalMapInfo<llvm::SlotIndex> >::subtree(unsigned int)
Line
Count
Source
706
80.7k
  NodeRef &subtree(unsigned i) { return this->first[i]; }
llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, unsigned int, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> >::subtree(unsigned int)
Line
Count
Source
706
1.02k
  NodeRef &subtree(unsigned i) { return this->first[i]; }
DAGCombiner.cpp:llvm::IntervalMapImpl::BranchNode<long long, (anonymous namespace)::UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::subtree(unsigned int)
Line
Count
Source
706
352
  NodeRef &subtree(unsigned i) { return this->first[i]; }
Unexecuted instantiation: DAGCombiner.cpp:llvm::IntervalMapImpl::BranchNode<long long, (anonymous namespace)::UnitT, 12u, llvm::IntervalMapHalfOpenInfo<long long> >::subtree(unsigned int)
707
708
  /// findFrom - Find the first subtree after i that may contain x.
709
  /// @param i    Starting index for the search.
710
  /// @param Size Number of elements in node.
711
  /// @param x    Key to search for.
712
  /// @return     First index with !stopLess(key[i], x), or size.
713
  ///             This is the first subtree that can possibly contain x.
714
36.4M
  unsigned findFrom(unsigned i, unsigned Size, KeyT x) const {
715
36.4M
    assert(i <= Size && Size <= N && "Bad indices");
716
36.4M
    assert((i == 0 || Traits::stopLess(stop(i - 1), x)) &&
717
36.4M
           "Index to findFrom is past the needed point");
718
89.1M
    while (i != Size && 
Traits::stopLess(stop(i), x)86.3M
)
++i52.6M
;
719
36.4M
    return i;
720
36.4M
  }
llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, llvm::LiveInterval*, 11u, llvm::IntervalMapInfo<llvm::SlotIndex> >::findFrom(unsigned int, unsigned int, llvm::SlotIndex) const
Line
Count
Source
714
35.6M
  unsigned findFrom(unsigned i, unsigned Size, KeyT x) const {
715
35.6M
    assert(i <= Size && Size <= N && "Bad indices");
716
35.6M
    assert((i == 0 || Traits::stopLess(stop(i - 1), x)) &&
717
35.6M
           "Index to findFrom is past the needed point");
718
87.2M
    while (i != Size && 
Traits::stopLess(stop(i), x)84.5M
)
++i51.6M
;
719
35.6M
    return i;
720
35.6M
  }
llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::findFrom(unsigned int, unsigned int, llvm::SlotIndex) const
Line
Count
Source
714
95
  unsigned findFrom(unsigned i, unsigned Size, KeyT x) const {
715
95
    assert(i <= Size && Size <= N && "Bad indices");
716
95
    assert((i == 0 || Traits::stopLess(stop(i - 1), x)) &&
717
95
           "Index to findFrom is past the needed point");
718
106
    while (i != Size && 
Traits::stopLess(stop(i), x)95
)
++i11
;
719
95
    return i;
720
95
  }
llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, unsigned int, 11u, llvm::IntervalMapInfo<llvm::SlotIndex> >::findFrom(unsigned int, unsigned int, llvm::SlotIndex) const
Line
Count
Source
714
790k
  unsigned findFrom(unsigned i, unsigned Size, KeyT x) const {
715
790k
    assert(i <= Size && Size <= N && "Bad indices");
716
790k
    assert((i == 0 || Traits::stopLess(stop(i - 1), x)) &&
717
790k
           "Index to findFrom is past the needed point");
718
1.81M
    while (i != Size && 
Traits::stopLess(stop(i), x)1.76M
)
++i1.02M
;
719
790k
    return i;
720
790k
  }
DAGCombiner.cpp:llvm::IntervalMapImpl::BranchNode<long long, (anonymous namespace)::UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::findFrom(unsigned int, unsigned int, long long) const
Line
Count
Source
714
2.21k
  unsigned findFrom(unsigned i, unsigned Size, KeyT x) const {
715
2.21k
    assert(i <= Size && Size <= N && "Bad indices");
716
2.21k
    assert((i == 0 || Traits::stopLess(stop(i - 1), x)) &&
717
2.21k
           "Index to findFrom is past the needed point");
718
2.22k
    while (i != Size && 
Traits::stopLess(stop(i), x)2.22k
)
++i9
;
719
2.21k
    return i;
720
2.21k
  }
721
722
  /// safeFind - Find a subtree that is known to exist. This is the same as
723
  /// findFrom except is it assumed that x is in range.
724
  /// @param i Starting index for the search.
725
  /// @param x Key to search for.
726
  /// @return  First index with !stopLess(key[i], x), never size.
727
  ///          This is the first subtree that can possibly contain x.
728
4.92M
  unsigned safeFind(unsigned i, KeyT x) const {
729
4.92M
    assert(i < N && "Bad index");
730
4.92M
    assert((i == 0 || Traits::stopLess(stop(i - 1), x)) &&
731
4.92M
           "Index is past the needed point");
732
24.0M
    while (Traits::stopLess(stop(i), x)) 
++i19.1M
;
733
4.92M
    assert(i < N && "Unsafe intervals");
734
4.92M
    return i;
735
4.92M
  }
llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, llvm::LiveInterval*, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> >::safeFind(unsigned int, llvm::SlotIndex) const
Line
Count
Source
728
4.52M
  unsigned safeFind(unsigned i, KeyT x) const {
729
4.52M
    assert(i < N && "Bad index");
730
4.52M
    assert((i == 0 || Traits::stopLess(stop(i - 1), x)) &&
731
4.52M
           "Index is past the needed point");
732
23.1M
    while (Traits::stopLess(stop(i), x)) 
++i18.5M
;
733
4.52M
    assert(i < N && "Unsafe intervals");
734
4.52M
    return i;
735
4.52M
  }
Unexecuted instantiation: llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, DbgValueLocation, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> >::safeFind(unsigned int, llvm::SlotIndex) const
llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, unsigned int, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> >::safeFind(unsigned int, llvm::SlotIndex) const
Line
Count
Source
728
45.4k
  unsigned safeFind(unsigned i, KeyT x) const {
729
45.4k
    assert(i < N && "Bad index");
730
45.4k
    assert((i == 0 || Traits::stopLess(stop(i - 1), x)) &&
731
45.4k
           "Index is past the needed point");
732
238k
    while (Traits::stopLess(stop(i), x)) 
++i193k
;
733
45.4k
    assert(i < N && "Unsafe intervals");
734
45.4k
    return i;
735
45.4k
  }
llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, unsigned int, 11u, llvm::IntervalMapInfo<llvm::SlotIndex> >::safeFind(unsigned int, llvm::SlotIndex) const
Line
Count
Source
728
364k
  unsigned safeFind(unsigned i, KeyT x) const {
729
364k
    assert(i < N && "Bad index");
730
364k
    assert((i == 0 || Traits::stopLess(stop(i - 1), x)) &&
731
364k
           "Index is past the needed point");
732
739k
    while (Traits::stopLess(stop(i), x)) 
++i374k
;
733
364k
    assert(i < N && "Unsafe intervals");
734
364k
    return i;
735
364k
  }
Unexecuted instantiation: DAGCombiner.cpp:llvm::IntervalMapImpl::BranchNode<long long, (anonymous namespace)::UnitT, 12u, llvm::IntervalMapHalfOpenInfo<long long> >::safeFind(unsigned int, long long) const
736
737
  /// safeLookup - Get the subtree containing x, Assuming that x is in range.
738
  /// @param x Key to search for.
739
  /// @return  Subtree containing x
740
384k
  NodeRef safeLookup(KeyT x) const {
741
384k
    return subtree(safeFind(0, x));
742
384k
  }
llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, unsigned int, 11u, llvm::IntervalMapInfo<llvm::SlotIndex> >::safeLookup(llvm::SlotIndex) const
Line
Count
Source
740
364k
  NodeRef safeLookup(KeyT x) const {
741
364k
    return subtree(safeFind(0, x));
742
364k
  }
llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, unsigned int, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> >::safeLookup(llvm::SlotIndex) const
Line
Count
Source
740
19.8k
  NodeRef safeLookup(KeyT x) const {
741
19.8k
    return subtree(safeFind(0, x));
742
19.8k
  }
743
744
  /// insert - Insert a new (subtree, stop) pair.
745
  /// @param i    Insert position, following entries will be shifted.
746
  /// @param Size Number of elements in node.
747
  /// @param Node Subtree to insert.
748
  /// @param Stop Last key in subtree.
749
445k
  void insert(unsigned i, unsigned Size, NodeRef Node, KeyT Stop) {
750
445k
    assert(Size < N && "branch node overflow");
751
445k
    assert(i <= Size && "Bad insert position");
752
445k
    this->shift(i, Size);
753
445k
    subtree(i) = Node;
754
445k
    stop(i) = Stop;
755
445k
  }
Unexecuted instantiation: llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::insert(unsigned int, unsigned int, llvm::IntervalMapImpl::NodeRef, llvm::SlotIndex)
Unexecuted instantiation: llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, DbgValueLocation, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> >::insert(unsigned int, unsigned int, llvm::IntervalMapImpl::NodeRef, llvm::SlotIndex)
llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, llvm::LiveInterval*, 11u, llvm::IntervalMapInfo<llvm::SlotIndex> >::insert(unsigned int, unsigned int, llvm::IntervalMapImpl::NodeRef, llvm::SlotIndex)
Line
Count
Source
749
330k
  void insert(unsigned i, unsigned Size, NodeRef Node, KeyT Stop) {
750
330k
    assert(Size < N && "branch node overflow");
751
330k
    assert(i <= Size && "Bad insert position");
752
330k
    this->shift(i, Size);
753
330k
    subtree(i) = Node;
754
330k
    stop(i) = Stop;
755
330k
  }
llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, llvm::LiveInterval*, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> >::insert(unsigned int, unsigned int, llvm::IntervalMapImpl::NodeRef, llvm::SlotIndex)
Line
Count
Source
749
105k
  void insert(unsigned i, unsigned Size, NodeRef Node, KeyT Stop) {
750
105k
    assert(Size < N && "branch node overflow");
751
105k
    assert(i <= Size && "Bad insert position");
752
105k
    this->shift(i, Size);
753
105k
    subtree(i) = Node;
754
105k
    stop(i) = Stop;
755
105k
  }
llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, unsigned int, 11u, llvm::IntervalMapInfo<llvm::SlotIndex> >::insert(unsigned int, unsigned int, llvm::IntervalMapImpl::NodeRef, llvm::SlotIndex)
Line
Count
Source
749
8.50k
  void insert(unsigned i, unsigned Size, NodeRef Node, KeyT Stop) {
750
8.50k
    assert(Size < N && "branch node overflow");
751
8.50k
    assert(i <= Size && "Bad insert position");
752
8.50k
    this->shift(i, Size);
753
8.50k
    subtree(i) = Node;
754
8.50k
    stop(i) = Stop;
755
8.50k
  }
llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, unsigned int, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> >::insert(unsigned int, unsigned int, llvm::IntervalMapImpl::NodeRef, llvm::SlotIndex)
Line
Count
Source
749
1.02k
  void insert(unsigned i, unsigned Size, NodeRef Node, KeyT Stop) {
750
1.02k
    assert(Size < N && "branch node overflow");
751
1.02k
    assert(i <= Size && "Bad insert position");
752
1.02k
    this->shift(i, Size);
753
1.02k
    subtree(i) = Node;
754
1.02k
    stop(i) = Stop;
755
1.02k
  }
DAGCombiner.cpp:llvm::IntervalMapImpl::BranchNode<long long, (anonymous namespace)::UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::insert(unsigned int, unsigned int, llvm::IntervalMapImpl::NodeRef, long long)
Line
Count
Source
749
84
  void insert(unsigned i, unsigned Size, NodeRef Node, KeyT Stop) {
750
84
    assert(Size < N && "branch node overflow");
751
84
    assert(i <= Size && "Bad insert position");
752
84
    this->shift(i, Size);
753
84
    subtree(i) = Node;
754
84
    stop(i) = Stop;
755
84
  }
Unexecuted instantiation: DAGCombiner.cpp:llvm::IntervalMapImpl::BranchNode<long long, (anonymous namespace)::UnitT, 12u, llvm::IntervalMapHalfOpenInfo<long long> >::insert(unsigned int, unsigned int, llvm::IntervalMapImpl::NodeRef, long long)
756
};
757
758
//===----------------------------------------------------------------------===//
759
//---                         IntervalMapImpl::Path                        ---//
760
//===----------------------------------------------------------------------===//
761
//
762
// A Path is used by iterators to represent a position in a B+-tree, and the
763
// path to get there from the root.
764
//
765
// The Path class also contains the tree navigation code that doesn't have to
766
// be templatized.
767
//
768
//===----------------------------------------------------------------------===//
769
770
class Path {
771
  /// Entry - Each step in the path is a node pointer and an offset into that
772
  /// node.
773
0
  struct Entry {
774
    void *node;
775
    unsigned size;
776
    unsigned offset;
777
778
    Entry(void *Node, unsigned Size, unsigned Offset)
779
164M
      : node(Node), size(Size), offset(Offset) {}
780
781
    Entry(NodeRef Node, unsigned Offset)
782
49.9M
      : node(&Node.subtree(0)), size(Node.size()), offset(Offset) {}
783
784
56.6M
    NodeRef &subtree(unsigned i) const {
785
56.6M
      return reinterpret_cast<NodeRef*>(node)[i];
786
56.6M
    }
787
  };
788
789
  /// path - The path entries, path[0] is the root node, path.back() is a leaf.
790
  SmallVector<Entry, 4> path;
791
792
public:
793
  // Node accessors.
794
6.82M
  template <typename NodeT> NodeT &node(unsigned Level) const {
795
6.82M
    return *reinterpret_cast<NodeT*>(path[Level].node);
796
6.82M
  }
llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, llvm::LiveInterval*, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> >& llvm::IntervalMapImpl::Path::node<llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, llvm::LiveInterval*, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> > >(unsigned int) const
Line
Count
Source
794
1.87M
  template <typename NodeT> NodeT &node(unsigned Level) const {
795
1.87M
    return *reinterpret_cast<NodeT*>(path[Level].node);
796
1.87M
  }
Unexecuted instantiation: llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, DbgValueLocation, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> >& llvm::IntervalMapImpl::Path::node<llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, DbgValueLocation, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> > >(unsigned int) const
llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >& llvm::IntervalMapImpl::Path::node<llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> > >(unsigned int) const
Line
Count
Source
794
16
  template <typename NodeT> NodeT &node(unsigned Level) const {
795
16
    return *reinterpret_cast<NodeT*>(path[Level].node);
796
16
  }
Unexecuted instantiation: llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, DbgValueLocation, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >& llvm::IntervalMapImpl::Path::node<llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, DbgValueLocation, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> > >(unsigned int) const
llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, llvm::LiveInterval*, 11u, llvm::IntervalMapInfo<llvm::SlotIndex> >& llvm::IntervalMapImpl::Path::node<llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, llvm::LiveInterval*, 11u, llvm::IntervalMapInfo<llvm::SlotIndex> > >(unsigned int) const
Line
Count
Source
794
3.48M
  template <typename NodeT> NodeT &node(unsigned Level) const {
795
3.48M
    return *reinterpret_cast<NodeT*>(path[Level].node);
796
3.48M
  }
llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >& llvm::IntervalMapImpl::Path::node<llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> > >(unsigned int) const
Line
Count
Source
794
1.22M
  template <typename NodeT> NodeT &node(unsigned Level) const {
795
1.22M
    return *reinterpret_cast<NodeT*>(path[Level].node);
796
1.22M
  }
llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, unsigned int, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> >& llvm::IntervalMapImpl::Path::node<llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, unsigned int, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> > >(unsigned int) const
Line
Count
Source
794
13.8k
  template <typename NodeT> NodeT &node(unsigned Level) const {
795
13.8k
    return *reinterpret_cast<NodeT*>(path[Level].node);
796
13.8k
  }
llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, unsigned int, 11u, llvm::IntervalMapInfo<llvm::SlotIndex> >& llvm::IntervalMapImpl::Path::node<llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, unsigned int, 11u, llvm::IntervalMapInfo<llvm::SlotIndex> > >(unsigned int) const
Line
Count
Source
794
179k
  template <typename NodeT> NodeT &node(unsigned Level) const {
795
179k
    return *reinterpret_cast<NodeT*>(path[Level].node);
796
179k
  }
llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >& llvm::IntervalMapImpl::Path::node<llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> > >(unsigned int) const
Line
Count
Source
794
37.2k
  template <typename NodeT> NodeT &node(unsigned Level) const {
795
37.2k
    return *reinterpret_cast<NodeT*>(path[Level].node);
796
37.2k
  }
Unexecuted instantiation: DAGCombiner.cpp:llvm::IntervalMapImpl::BranchNode<long long, (anonymous namespace)::UnitT, 12u, llvm::IntervalMapHalfOpenInfo<long long> >& llvm::IntervalMapImpl::Path::node<llvm::IntervalMapImpl::BranchNode<long long, (anonymous namespace)::UnitT, 12u, llvm::IntervalMapHalfOpenInfo<long long> > >(unsigned int) const
DAGCombiner.cpp:llvm::IntervalMapImpl::BranchNode<long long, (anonymous namespace)::UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >& llvm::IntervalMapImpl::Path::node<llvm::IntervalMapImpl::BranchNode<long long, (anonymous namespace)::UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> > >(unsigned int) const
Line
Count
Source
794
352
  template <typename NodeT> NodeT &node(unsigned Level) const {
795
352
    return *reinterpret_cast<NodeT*>(path[Level].node);
796
352
  }
DAGCombiner.cpp:llvm::IntervalMapImpl::LeafNode<long long, (anonymous namespace)::UnitT, 11u, llvm::IntervalMapHalfOpenInfo<long long> >& llvm::IntervalMapImpl::Path::node<llvm::IntervalMapImpl::LeafNode<long long, (anonymous namespace)::UnitT, 11u, llvm::IntervalMapHalfOpenInfo<long long> > >(unsigned int) const
Line
Count
Source
794
196
  template <typename NodeT> NodeT &node(unsigned Level) const {
795
196
    return *reinterpret_cast<NodeT*>(path[Level].node);
796
196
  }
797
1.62M
  unsigned size(unsigned Level) const { return path[Level].size; }
798
0
  unsigned offset(unsigned Level) const { return path[Level].offset; }
799
13.4M
  unsigned &offset(unsigned Level) { return path[Level].offset; }
800
801
  // Leaf accessors.
802
848M
  template <typename NodeT> NodeT &leaf() const {
803
848M
    return *reinterpret_cast<NodeT*>(path.back().node);
804
848M
  }
llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >& llvm::IntervalMapImpl::Path::leaf<llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> > >() const
Line
Count
Source
802
843M
  template <typename NodeT> NodeT &leaf() const {
803
843M
    return *reinterpret_cast<NodeT*>(path.back().node);
804
843M
  }
llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, DbgValueLocation, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >& llvm::IntervalMapImpl::Path::leaf<llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, DbgValueLocation, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> > >() const
Line
Count
Source
802
547
  template <typename NodeT> NodeT &leaf() const {
803
547
    return *reinterpret_cast<NodeT*>(path.back().node);
804
547
  }
llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >& llvm::IntervalMapImpl::Path::leaf<llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> > >() const
Line
Count
Source
802
71.8k
  template <typename NodeT> NodeT &leaf() const {
803
71.8k
    return *reinterpret_cast<NodeT*>(path.back().node);
804
71.8k
  }
llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >& llvm::IntervalMapImpl::Path::leaf<llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> > >() const
Line
Count
Source
802
4.96M
  template <typename NodeT> NodeT &leaf() const {
803
4.96M
    return *reinterpret_cast<NodeT*>(path.back().node);
804
4.96M
  }
DAGCombiner.cpp:llvm::IntervalMapImpl::LeafNode<long long, (anonymous namespace)::UnitT, 11u, llvm::IntervalMapHalfOpenInfo<long long> >& llvm::IntervalMapImpl::Path::leaf<llvm::IntervalMapImpl::LeafNode<long long, (anonymous namespace)::UnitT, 11u, llvm::IntervalMapHalfOpenInfo<long long> > >() const
Line
Count
Source
802
450k
  template <typename NodeT> NodeT &leaf() const {
803
450k
    return *reinterpret_cast<NodeT*>(path.back().node);
804
450k
  }
DAGCombiner.cpp:llvm::IntervalMapImpl::LeafNode<long long, (anonymous namespace)::UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >& llvm::IntervalMapImpl::Path::leaf<llvm::IntervalMapImpl::LeafNode<long long, (anonymous namespace)::UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> > >() const
Line
Count
Source
802
251k
  template <typename NodeT> NodeT &leaf() const {
803
251k
    return *reinterpret_cast<NodeT*>(path.back().node);
804
251k
  }
805
86.1M
  unsigned leafSize() const { return path.back().size; }
806
814M
  unsigned leafOffset() const { return path.back().offset; }
807
154M
  unsigned &leafOffset() { return path.back().offset; }
808
809
  /// valid - Return true if path is at a valid node, not at end().
810
468M
  bool valid() const {
811
468M
    return 
!path.empty()468M
&& path.front().offset < path.front().size;
812
468M
  }
813
814
  /// height - Return the height of the tree corresponding to this path.
815
  /// This matches map->height in a full path.
816
83.1M
  unsigned height() const { return path.size() - 1; }
817
818
  /// subtree - Get the subtree referenced from Level. When the path is
819
  /// consistent, node(Level + 1) == subtree(Level).
820
  /// @param Level 0..height-1. The leaves have no subtrees.
821
54.6M
  NodeRef &subtree(unsigned Level) const {
822
54.6M
    return path[Level].subtree(path[Level].offset);
823
54.6M
  }
824
825
  /// reset - Reset cached information about node(Level) from subtree(Level -1).
826
  /// @param Level 1..height. THe node to update after parent node changed.
827
473k
  void reset(unsigned Level) {
828
473k
    path[Level] = Entry(subtree(Level - 1), offset(Level));
829
473k
  }
830
831
  /// push - Add entry to path.
832
  /// @param Node Node to add, should be subtree(path.size()-1).
833
  /// @param Offset Offset into Node.
834
38.2M
  void push(NodeRef Node, unsigned Offset) {
835
38.2M
    path.push_back(Entry(Node, Offset));
836
38.2M
  }
837
838
  /// pop - Remove the last path entry.
839
3.64M
  void pop() {
840
3.64M
    path.pop_back();
841
3.64M
  }
842
843
  /// setSize - Set the size of a node both in the path and in the tree.
844
  /// @param Level 0..height. Note that setting the root size won't change
845
  ///              map->rootSize.
846
  /// @param Size New node size.
847
22.1M
  void setSize(unsigned Level, unsigned Size) {
848
22.1M
    path[Level].size = Size;
849
22.1M
    if (Level)
850
9.17M
      subtree(Level - 1).setSize(Size);
851
22.1M
  }
852
853
  /// setRoot - Clear the path and set a new root node.
854
  /// @param Node New root node.
855
  /// @param Size New root size.
856
  /// @param Offset Offset into root node.
857
162M
  void setRoot(void *Node, unsigned Size, unsigned Offset) {
858
162M
    path.clear();
859
162M
    path.push_back(Entry(Node, Size, Offset));
860
162M
  }
861
862
  /// replaceRoot - Replace the current root node with two new entries after the
863
  /// tree height has increased.
864
  /// @param Root The new root node.
865
  /// @param Size Number of entries in the new root.
866
  /// @param Offsets Offsets into the root and first branch nodes.
867
  void replaceRoot(void *Root, unsigned Size, IdxPair Offsets);
868
869
  /// getLeftSibling - Get the left sibling node at Level, or a null NodeRef.
870
  /// @param Level Get the sibling to node(Level).
871
  /// @return Left sibling, or NodeRef().
872
  NodeRef getLeftSibling(unsigned Level) const;
873
874
  /// moveLeft - Move path to the left sibling at Level. Leave nodes below Level
875
  /// unaltered.
876
  /// @param Level Move node(Level).
877
  void moveLeft(unsigned Level);
878
879
  /// fillLeft - Grow path to Height by taking leftmost branches.
880
  /// @param Height The target height.
881
17.5k
  void fillLeft(unsigned Height) {
882
35.2k
    while (height() < Height)
883
17.6k
      push(subtree(height()), 0);
884
17.5k
  }
885
886
  /// getLeftSibling - Get the left sibling node at Level, or a null NodeRef.
887
  /// @param Level Get the sinbling to node(Level).
888
  /// @return Left sibling, or NodeRef().
889
  NodeRef getRightSibling(unsigned Level) const;
890
891
  /// moveRight - Move path to the left sibling at Level. Leave nodes below
892
  /// Level unaltered.
893
  /// @param Level Move node(Level).
894
  void moveRight(unsigned Level);
895
896
  /// atBegin - Return true if path is at begin().
897
403k
  bool atBegin() const {
898
891k
    for (unsigned i = 0, e = path.size(); i != e; 
++i487k
)
899
683k
      if (path[i].offset != 0)
900
195k
        return false;
901
403k
    
return true207k
;
902
403k
  }
903
904
  /// atLastEntry - Return true if the path is at the last entry of the node at
905
  /// Level.
906
  /// @param Level Node to examine.
907
6.38M
  bool atLastEntry(unsigned Level) const {
908
6.38M
    return path[Level].offset == path[Level].size - 1;
909
6.38M
  }
910
911
  /// legalizeForInsert - Prepare the path for an insertion at Level. When the
912
  /// path is at end(), node(Level) may not be a legal node. legalizeForInsert
913
  /// ensures that node(Level) is real by moving back to the last node at Level,
914
  /// and setting offset(Level) to size(Level) if required.
915
  /// @param Level The level where an insertion is about to take place.
916
1.13M
  void legalizeForInsert(unsigned Level) {
917
1.13M
    if (valid())
918
106k
      return;
919
1.02M
    moveLeft(Level);
920
1.02M
    ++path[Level].offset;
921
1.02M
  }
922
};
923
924
} // end namespace IntervalMapImpl
925
926
//===----------------------------------------------------------------------===//
927
//---                          IntervalMap                                ----//
928
//===----------------------------------------------------------------------===//
929
930
template <typename KeyT, typename ValT,
931
          unsigned N = IntervalMapImpl::NodeSizer<KeyT, ValT>::LeafSize,
932
          typename Traits = IntervalMapInfo<KeyT>>
933
class IntervalMap {
934
  using Sizer = IntervalMapImpl::NodeSizer<KeyT, ValT>;
935
  using Leaf = IntervalMapImpl::LeafNode<KeyT, ValT, Sizer::LeafSize, Traits>;
936
  using Branch =
937
      IntervalMapImpl::BranchNode<KeyT, ValT, Sizer::BranchSize, Traits>;
938
  using RootLeaf = IntervalMapImpl::LeafNode<KeyT, ValT, N, Traits>;
939
  using IdxPair = IntervalMapImpl::IdxPair;
940
941
  // The RootLeaf capacity is given as a template parameter. We must compute the
942
  // corresponding RootBranch capacity.
943
  enum {
944
    DesiredRootBranchCap = (sizeof(RootLeaf) - sizeof(KeyT)) /
945
      (sizeof(KeyT) + sizeof(IntervalMapImpl::NodeRef)),
946
    RootBranchCap = DesiredRootBranchCap ? DesiredRootBranchCap : 1
947
  };
948
949
  using RootBranch =
950
      IntervalMapImpl::BranchNode<KeyT, ValT, RootBranchCap, Traits>;
951
952
  // When branched, we store a global start key as well as the branch node.
953
  struct RootBranchData {
954
    KeyT start;
955
    RootBranch node;
956
  };
957
958
public:
959
  using Allocator = typename Sizer::Allocator;
960
  using KeyType = KeyT;
961
  using ValueType = ValT;
962
  using KeyTraits = Traits;
963
964
private:
965
  // The root data is either a RootLeaf or a RootBranchData instance.
966
  LLVM_ALIGNAS(RootLeaf) LLVM_ALIGNAS(RootBranchData)
967
  AlignedCharArrayUnion<RootLeaf, RootBranchData> data;
968
969
  // Tree height.
970
  // 0: Leaves in root.
971
  // 1: Root points to leaf.
972
  // 2: root->branch->leaf ...
973
  unsigned height;
974
975
  // Number of entries in the root node.
976
  unsigned rootSize;
977
978
  // Allocator used for creating external nodes.
979
  Allocator &allocator;
980
981
  /// Represent data as a node type without breaking aliasing rules.
982
  template <typename T>
983
388M
  T &dataAs() const {
984
388M
    return *bit_cast<T *>(const_cast<char *>(data.buffer));
985
388M
  }
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::RootBranchData& llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::dataAs<llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::RootBranchData>() const
Line
Count
Source
983
76.1M
  T &dataAs() const {
984
76.1M
    return *bit_cast<T *>(const_cast<char *>(data.buffer));
985
76.1M
  }
llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >& llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::dataAs<llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> > >() const
Line
Count
Source
983
286M
  T &dataAs() const {
984
286M
    return *bit_cast<T *>(const_cast<char *>(data.buffer));
985
286M
  }
llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >& llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::dataAs<llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> > >() const
Line
Count
Source
983
65.2k
  T &dataAs() const {
984
65.2k
    return *bit_cast<T *>(const_cast<char *>(data.buffer));
985
65.2k
  }
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::RootBranchData& llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::dataAs<llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::RootBranchData>() const
Line
Count
Source
983
244
  T &dataAs() const {
984
244
    return *bit_cast<T *>(const_cast<char *>(data.buffer));
985
244
  }
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::RootBranchData& llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::dataAs<llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::RootBranchData>() const
Line
Count
Source
983
2.88M
  T &dataAs() const {
984
2.88M
    return *bit_cast<T *>(const_cast<char *>(data.buffer));
985
2.88M
  }
llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >& llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::dataAs<llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> > >() const
Line
Count
Source
983
9.48M
  T &dataAs() const {
984
9.48M
    return *bit_cast<T *>(const_cast<char *>(data.buffer));
985
9.48M
  }
DAGCombiner.cpp:llvm::IntervalMapImpl::LeafNode<long long, (anonymous namespace)::UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >& llvm::IntervalMap<long long, (anonymous namespace)::UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::dataAs<llvm::IntervalMapImpl::LeafNode<long long, (anonymous namespace)::UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> > >() const
Line
Count
Source
983
13.4M
  T &dataAs() const {
984
13.4M
    return *bit_cast<T *>(const_cast<char *>(data.buffer));
985
13.4M
  }
DAGCombiner.cpp:llvm::IntervalMap<long long, (anonymous namespace)::UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::RootBranchData& llvm::IntervalMap<long long, (anonymous namespace)::UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::dataAs<llvm::IntervalMap<long long, (anonymous namespace)::UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::RootBranchData>() const
Line
Count
Source
983
8.65k
  T &dataAs() const {
984
8.65k
    return *bit_cast<T *>(const_cast<char *>(data.buffer));
985
8.65k
  }
986
987
3.80M
  const RootLeaf &rootLeaf() const {
988
3.80M
    assert(!branched() && "Cannot acces leaf data in branched root");
989
3.80M
    return dataAs<RootLeaf>();
990
3.80M
  }
Unexecuted instantiation: llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::rootLeaf() const
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::rootLeaf() const
Line
Count
Source
987
3.80M
  const RootLeaf &rootLeaf() const {
988
3.80M
    assert(!branched() && "Cannot acces leaf data in branched root");
989
3.80M
    return dataAs<RootLeaf>();
990
3.80M
  }
991
305M
  RootLeaf &rootLeaf() {
992
305M
    assert(!branched() && "Cannot acces leaf data in branched root");
993
305M
    return dataAs<RootLeaf>();
994
305M
  }
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::rootLeaf()
Line
Count
Source
991
286M
  RootLeaf &rootLeaf() {
992
286M
    assert(!branched() && "Cannot acces leaf data in branched root");
993
286M
    return dataAs<RootLeaf>();
994
286M
  }
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::rootLeaf()
Line
Count
Source
991
65.2k
  RootLeaf &rootLeaf() {
992
65.2k
    assert(!branched() && "Cannot acces leaf data in branched root");
993
65.2k
    return dataAs<RootLeaf>();
994
65.2k
  }
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::rootLeaf()
Line
Count
Source
991
5.68M
  RootLeaf &rootLeaf() {
992
5.68M
    assert(!branched() && "Cannot acces leaf data in branched root");
993
5.68M
    return dataAs<RootLeaf>();
994
5.68M
  }
DAGCombiner.cpp:llvm::IntervalMap<long long, (anonymous namespace)::UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::rootLeaf()
Line
Count
Source
991
13.4M
  RootLeaf &rootLeaf() {
992
13.4M
    assert(!branched() && "Cannot acces leaf data in branched root");
993
13.4M
    return dataAs<RootLeaf>();
994
13.4M
  }
995
996
1.10M
  RootBranchData &rootBranchData() const {
997
1.10M
    assert(branched() && "Cannot access branch data in non-branched root");
998
1.10M
    return dataAs<RootBranchData>();
999
1.10M
  }
Unexecuted instantiation: llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::rootBranchData() const
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::rootBranchData() const
Line
Count
Source
996
1.10M
  RootBranchData &rootBranchData() const {
997
1.10M
    assert(branched() && "Cannot access branch data in non-branched root");
998
1.10M
    return dataAs<RootBranchData>();
999
1.10M
  }
1000
77.9M
  RootBranchData &rootBranchData() {
1001
77.9M
    assert(branched() && "Cannot access branch data in non-branched root");
1002
77.9M
    return dataAs<RootBranchData>();
1003
77.9M
  }
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::rootBranchData()
Line
Count
Source
1000
76.1M
  RootBranchData &rootBranchData() {
1001
76.1M
    assert(branched() && "Cannot access branch data in non-branched root");
1002
76.1M
    return dataAs<RootBranchData>();
1003
76.1M
  }
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::rootBranchData()
Line
Count
Source
1000
244
  RootBranchData &rootBranchData() {
1001
244
    assert(branched() && "Cannot access branch data in non-branched root");
1002
244
    return dataAs<RootBranchData>();
1003
244
  }
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::rootBranchData()
Line
Count
Source
1000
1.77M
  RootBranchData &rootBranchData() {
1001
1.77M
    assert(branched() && "Cannot access branch data in non-branched root");
1002
1.77M
    return dataAs<RootBranchData>();
1003
1.77M
  }
DAGCombiner.cpp:llvm::IntervalMap<long long, (anonymous namespace)::UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::rootBranchData()
Line
Count
Source
1000
8.65k
  RootBranchData &rootBranchData() {
1001
8.65k
    assert(branched() && "Cannot access branch data in non-branched root");
1002
8.65k
    return dataAs<RootBranchData>();
1003
8.65k
  }
1004
1005
732k
  const RootBranch &rootBranch() const { return rootBranchData().node; }
1006
76.6M
  RootBranch &rootBranch()             { return rootBranchData().node; }
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::rootBranch()
Line
Count
Source
1006
74.9M
  RootBranch &rootBranch()             { return rootBranchData().node; }
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::rootBranch()
Line
Count
Source
1006
229
  RootBranch &rootBranch()             { return rootBranchData().node; }
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::rootBranch()
Line
Count
Source
1006
1.72M
  RootBranch &rootBranch()             { return rootBranchData().node; }
DAGCombiner.cpp:llvm::IntervalMap<long long, (anonymous namespace)::UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::rootBranch()
Line
Count
Source
1006
7.18k
  RootBranch &rootBranch()             { return rootBranchData().node; }
1007
371k
  KeyT rootBranchStart() const { return rootBranchData().start; }
Unexecuted instantiation: llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::rootBranchStart() const
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::rootBranchStart() const
Line
Count
Source
1007
371k
  KeyT rootBranchStart() const { return rootBranchData().start; }
1008
632k
  KeyT &rootBranchStart()      { return rootBranchData().start; }
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::rootBranchStart()
Line
Count
Source
1008
5
  KeyT &rootBranchStart()      { return rootBranchData().start; }
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::rootBranchStart()
Line
Count
Source
1008
613k
  KeyT &rootBranchStart()      { return rootBranchData().start; }
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::rootBranchStart()
Line
Count
Source
1008
17.4k
  KeyT &rootBranchStart()      { return rootBranchData().start; }
DAGCombiner.cpp:llvm::IntervalMap<long long, (anonymous namespace)::UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::rootBranchStart()
Line
Count
Source
1008
1.29k
  KeyT &rootBranchStart()      { return rootBranchData().start; }
1009
1010
1.10M
  template <typename NodeT> NodeT *newNode() {
1011
1.10M
    return new(allocator.template Allocate<NodeT>()) NodeT();
1012
1.10M
  }
llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, DbgValueLocation, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >* llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::newNode<llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, DbgValueLocation, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> > >()
Line
Count
Source
1010
5
  template <typename NodeT> NodeT *newNode() {
1011
5
    return new(allocator.template Allocate<NodeT>()) NodeT();
1012
5
  }
Unexecuted instantiation: llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, DbgValueLocation, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> >* llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::newNode<llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, DbgValueLocation, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> > >()
llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >* llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::newNode<llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> > >()
Line
Count
Source
1010
1.04M
  template <typename NodeT> NodeT *newNode() {
1011
1.04M
    return new(allocator.template Allocate<NodeT>()) NodeT();
1012
1.04M
  }
llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, llvm::LiveInterval*, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> >* llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::newNode<llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, llvm::LiveInterval*, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> > >()
Line
Count
Source
1010
19.6k
  template <typename NodeT> NodeT *newNode() {
1011
19.6k
    return new(allocator.template Allocate<NodeT>()) NodeT();
1012
19.6k
  }
llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >* llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::newNode<llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> > >()
Line
Count
Source
1010
42.2k
  template <typename NodeT> NodeT *newNode() {
1011
42.2k
    return new(allocator.template Allocate<NodeT>()) NodeT();
1012
42.2k
  }
llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, unsigned int, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> >* llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::newNode<llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, unsigned int, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> > >()
Line
Count
Source
1010
210
  template <typename NodeT> NodeT *newNode() {
1011
210
    return new(allocator.template Allocate<NodeT>()) NodeT();
1012
210
  }
DAGCombiner.cpp:llvm::IntervalMapImpl::LeafNode<long long, (anonymous namespace)::UnitT, 11u, llvm::IntervalMapHalfOpenInfo<long long> >* llvm::IntervalMap<long long, (anonymous namespace)::UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::newNode<llvm::IntervalMapImpl::LeafNode<long long, (anonymous namespace)::UnitT, 11u, llvm::IntervalMapHalfOpenInfo<long long> > >()
Line
Count
Source
1010
176
  template <typename NodeT> NodeT *newNode() {
1011
176
    return new(allocator.template Allocate<NodeT>()) NodeT();
1012
176
  }
Unexecuted instantiation: DAGCombiner.cpp:llvm::IntervalMapImpl::BranchNode<long long, (anonymous namespace)::UnitT, 12u, llvm::IntervalMapHalfOpenInfo<long long> >* llvm::IntervalMap<long long, (anonymous namespace)::UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::newNode<llvm::IntervalMapImpl::BranchNode<long long, (anonymous namespace)::UnitT, 12u, llvm::IntervalMapHalfOpenInfo<long long> > >()
1013
1014
1.10M
  template <typename NodeT> void deleteNode(NodeT *P) {
1015
1.10M
    P->~NodeT();
1016
1.10M
    allocator.Deallocate(P);
1017
1.10M
  }
Unexecuted instantiation: void llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::deleteNode<llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, DbgValueLocation, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> > >(llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, DbgValueLocation, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> >*)
void llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::deleteNode<llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, DbgValueLocation, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> > >(llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, DbgValueLocation, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >*)
Line
Count
Source
1014
5
  template <typename NodeT> void deleteNode(NodeT *P) {
1015
5
    P->~NodeT();
1016
5
    allocator.Deallocate(P);
1017
5
  }
void llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::deleteNode<llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, llvm::LiveInterval*, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> > >(llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, llvm::LiveInterval*, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> >*)
Line
Count
Source
1014
19.6k
  template <typename NodeT> void deleteNode(NodeT *P) {
1015
19.6k
    P->~NodeT();
1016
19.6k
    allocator.Deallocate(P);
1017
19.6k
  }
void llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::deleteNode<llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> > >(llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >*)
Line
Count
Source
1014
1.04M
  template <typename NodeT> void deleteNode(NodeT *P) {
1015
1.04M
    P->~NodeT();
1016
1.04M
    allocator.Deallocate(P);
1017
1.04M
  }
void llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::deleteNode<llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, unsigned int, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> > >(llvm::IntervalMapImpl::BranchNode<llvm::SlotIndex, unsigned int, 12u, llvm::IntervalMapInfo<llvm::SlotIndex> >*)
Line
Count
Source
1014
210
  template <typename NodeT> void deleteNode(NodeT *P) {
1015
210
    P->~NodeT();
1016
210
    allocator.Deallocate(P);
1017
210
  }
void llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::deleteNode<llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> > >(llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >*)
Line
Count
Source
1014
42.2k
  template <typename NodeT> void deleteNode(NodeT *P) {
1015
42.2k
    P->~NodeT();
1016
42.2k
    allocator.Deallocate(P);
1017
42.2k
  }
DAGCombiner.cpp:void llvm::IntervalMap<long long, (anonymous namespace)::UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::deleteNode<llvm::IntervalMapImpl::LeafNode<long long, (anonymous namespace)::UnitT, 11u, llvm::IntervalMapHalfOpenInfo<long long> > >(llvm::IntervalMapImpl::LeafNode<long long, (anonymous namespace)::UnitT, 11u, llvm::IntervalMapHalfOpenInfo<long long> >*)
Line
Count
Source
1014
176
  template <typename NodeT> void deleteNode(NodeT *P) {
1015
176
    P->~NodeT();
1016
176
    allocator.Deallocate(P);
1017
176
  }
Unexecuted instantiation: DAGCombiner.cpp:void llvm::IntervalMap<long long, (anonymous namespace)::UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::deleteNode<llvm::IntervalMapImpl::BranchNode<long long, (anonymous namespace)::UnitT, 12u, llvm::IntervalMapHalfOpenInfo<long long> > >(llvm::IntervalMapImpl::BranchNode<long long, (anonymous namespace)::UnitT, 12u, llvm::IntervalMapHalfOpenInfo<long long> >*)
1018
1019
  IdxPair branchRoot(unsigned Position);
1020
  IdxPair splitRoot(unsigned Position);
1021
1022
326k
  void switchRootToBranch() {
1023
326k
    rootLeaf().~RootLeaf();
1024
326k
    height = 1;
1025
326k
    new (&rootBranchData()) RootBranchData();
1026
326k
  }
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::switchRootToBranch()
Line
Count
Source
1022
5
  void switchRootToBranch() {
1023
5
    rootLeaf().~RootLeaf();
1024
5
    height = 1;
1025
5
    new (&rootBranchData()) RootBranchData();
1026
5
  }
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::switchRootToBranch()
Line
Count
Source
1022
309k
  void switchRootToBranch() {
1023
309k
    rootLeaf().~RootLeaf();
1024
309k
    height = 1;
1025
309k
    new (&rootBranchData()) RootBranchData();
1026
309k
  }
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::switchRootToBranch()
Line
Count
Source
1022
16.4k
  void switchRootToBranch() {
1023
16.4k
    rootLeaf().~RootLeaf();
1024
16.4k
    height = 1;
1025
16.4k
    new (&rootBranchData()) RootBranchData();
1026
16.4k
  }
DAGCombiner.cpp:llvm::IntervalMap<long long, (anonymous namespace)::UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::switchRootToBranch()
Line
Count
Source
1022
92
  void switchRootToBranch() {
1023
92
    rootLeaf().~RootLeaf();
1024
92
    height = 1;
1025
92
    new (&rootBranchData()) RootBranchData();
1026
92
  }
1027
1028
326k
  void switchRootToLeaf() {
1029
326k
    rootBranchData().~RootBranchData();
1030
326k
    height = 0;
1031
326k
    new(&rootLeaf()) RootLeaf();
1032
326k
  }
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::switchRootToLeaf()
Line
Count
Source
1028
5
  void switchRootToLeaf() {
1029
5
    rootBranchData().~RootBranchData();
1030
5
    height = 0;
1031
5
    new(&rootLeaf()) RootLeaf();
1032
5
  }
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::switchRootToLeaf()
Line
Count
Source
1028
309k
  void switchRootToLeaf() {
1029
309k
    rootBranchData().~RootBranchData();
1030
309k
    height = 0;
1031
309k
    new(&rootLeaf()) RootLeaf();
1032
309k
  }
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::switchRootToLeaf()
Line
Count
Source
1028
16.4k
  void switchRootToLeaf() {
1029
16.4k
    rootBranchData().~RootBranchData();
1030
16.4k
    height = 0;
1031
16.4k
    new(&rootLeaf()) RootLeaf();
1032
16.4k
  }
DAGCombiner.cpp:llvm::IntervalMap<long long, (anonymous namespace)::UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::switchRootToLeaf()
Line
Count
Source
1028
92
  void switchRootToLeaf() {
1029
92
    rootBranchData().~RootBranchData();
1030
92
    height = 0;
1031
92
    new(&rootLeaf()) RootLeaf();
1032
92
  }
1033
1034
1.29G
  bool branched() const { return height > 0; }
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::branched() const
Line
Count
Source
1034
1.26G
  bool branched() const { return height > 0; }
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::branched() const
Line
Count
Source
1034
170k
  bool branched() const { return height > 0; }
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::branched() const
Line
Count
Source
1034
15.9M
  bool branched() const { return height > 0; }
DAGCombiner.cpp:llvm::IntervalMap<long long, (anonymous namespace)::UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::branched() const
Line
Count
Source
1034
7.73M
  bool branched() const { return height > 0; }
1035
1036
  ValT treeSafeLookup(KeyT x, ValT NotFound) const;
1037
  void visitNodes(void (IntervalMap::*f)(IntervalMapImpl::NodeRef,
1038
                  unsigned Level));
1039
  void deleteNode(IntervalMapImpl::NodeRef Node, unsigned Level);
1040
1041
public:
1042
8.63M
  explicit IntervalMap(Allocator &a) : height(0), rootSize(0), allocator(a) {
1043
8.63M
    assert((uintptr_t(data.buffer) & (alignof(RootLeaf) - 1)) == 0 &&
1044
8.63M
           "Insufficient alignment");
1045
8.63M
    new(&rootLeaf()) RootLeaf();
1046
8.63M
  }
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::IntervalMap(llvm::RecyclingAllocator<llvm::BumpPtrAllocatorImpl<llvm::MallocAllocator, 4096ul, 4096ul>, char, 192ul, 64ul>&)
Line
Count
Source
1042
4.60k
  explicit IntervalMap(Allocator &a) : height(0), rootSize(0), allocator(a) {
1043
4.60k
    assert((uintptr_t(data.buffer) & (alignof(RootLeaf) - 1)) == 0 &&
1044
4.60k
           "Insufficient alignment");
1045
4.60k
    new(&rootLeaf()) RootLeaf();
1046
4.60k
  }
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::IntervalMap(llvm::RecyclingAllocator<llvm::BumpPtrAllocatorImpl<llvm::MallocAllocator, 4096ul, 4096ul>, char, 192ul, 64ul>&)
Line
Count
Source
1042
5.16M
  explicit IntervalMap(Allocator &a) : height(0), rootSize(0), allocator(a) {
1043
5.16M
    assert((uintptr_t(data.buffer) & (alignof(RootLeaf) - 1)) == 0 &&
1044
5.16M
           "Insufficient alignment");
1045
5.16M
    new(&rootLeaf()) RootLeaf();
1046
5.16M
  }
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::IntervalMap(llvm::RecyclingAllocator<llvm::BumpPtrAllocatorImpl<llvm::MallocAllocator, 4096ul, 4096ul>, char, 192ul, 64ul>&)
Line
Count
Source
1042
464k
  explicit IntervalMap(Allocator &a) : height(0), rootSize(0), allocator(a) {
1043
464k
    assert((uintptr_t(data.buffer) & (alignof(RootLeaf) - 1)) == 0 &&
1044
464k
           "Insufficient alignment");
1045
464k
    new(&rootLeaf()) RootLeaf();
1046
464k
  }
DAGCombiner.cpp:llvm::IntervalMap<long long, (anonymous namespace)::UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::IntervalMap(llvm::RecyclingAllocator<llvm::BumpPtrAllocatorImpl<llvm::MallocAllocator, 4096ul, 4096ul>, char, 192ul, 64ul>&)
Line
Count
Source
1042
3.00M
  explicit IntervalMap(Allocator &a) : height(0), rootSize(0), allocator(a) {
1043
3.00M
    assert((uintptr_t(data.buffer) & (alignof(RootLeaf) - 1)) == 0 &&
1044
3.00M
           "Insufficient alignment");
1045
3.00M
    new(&rootLeaf()) RootLeaf();
1046
3.00M
  }
1047
1048
8.63M
  ~IntervalMap() {
1049
8.63M
    clear();
1050
8.63M
    rootLeaf().~RootLeaf();
1051
8.63M
  }
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::~IntervalMap()
Line
Count
Source
1048
4.60k
  ~IntervalMap() {
1049
4.60k
    clear();
1050
4.60k
    rootLeaf().~RootLeaf();
1051
4.60k
  }
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::~IntervalMap()
Line
Count
Source
1048
5.16M
  ~IntervalMap() {
1049
5.16M
    clear();
1050
5.16M
    rootLeaf().~RootLeaf();
1051
5.16M
  }
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::~IntervalMap()
Line
Count
Source
1048
464k
  ~IntervalMap() {
1049
464k
    clear();
1050
464k
    rootLeaf().~RootLeaf();
1051
464k
  }
DAGCombiner.cpp:llvm::IntervalMap<long long, (anonymous namespace)::UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::~IntervalMap()
Line
Count
Source
1048
3.00M
  ~IntervalMap() {
1049
3.00M
    clear();
1050
3.00M
    rootLeaf().~RootLeaf();
1051
3.00M
  }
1052
1053
  /// empty -  Return true when no intervals are mapped.
1054
139M
  bool empty() const {
1055
139M
    return rootSize == 0;
1056
139M
  }
Unexecuted instantiation: llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::empty() const
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::empty() const
Line
Count
Source
1054
137M
  bool empty() const {
1055
137M
    return rootSize == 0;
1056
137M
  }
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::empty() const
Line
Count
Source
1054
1.78M
  bool empty() const {
1055
1.78M
    return rootSize == 0;
1056
1.78M
  }
Unexecuted instantiation: DAGCombiner.cpp:llvm::IntervalMap<long long, (anonymous namespace)::UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::empty() const
1057
1058
  /// start - Return the smallest mapped key in a non-empty map.
1059
1.78M
  KeyT start() const {
1060
1.78M
    assert(!empty() && "Empty IntervalMap has no start");
1061
1.78M
    return !branched() ? 
rootLeaf().start(0)1.41M
:
rootBranchStart()371k
;
1062
1.78M
  }
1063
1064
  /// stop - Return the largest mapped key in a non-empty map.
1065
1.64M
  KeyT stop() const {
1066
1.64M
    assert(!empty() && "Empty IntervalMap has no stop");
1067
1.64M
    return !branched() ? 
rootLeaf().stop(rootSize - 1)1.28M
:
1068
1.64M
                         
rootBranch().stop(rootSize - 1)368k
;
1069
1.64M
  }
1070
1071
  /// lookup - Return the mapped value at x or NotFound.
1072
1.78M
  ValT lookup(KeyT x, ValT NotFound = ValT()) const {
1073
1.78M
    if (empty() || Traits::startLess(x, start()) || 
Traits::stopLess(stop(), x)1.64M
)
1074
315k
      return NotFound;
1075
1.47M
    return branched() ? 
treeSafeLookup(x, NotFound)364k
:
1076
1.47M
                        
rootLeaf().safeLookup(x, NotFound)1.10M
;
1077
1.47M
  }
1078
1079
  /// insert - Add a mapping of [a;b] to y, coalesce with adjacent intervals.
1080
  /// It is assumed that no key in the interval is mapped to another value, but
1081
  /// overlapping intervals already mapped to y will be coalesced.
1082
5.94M
  void insert(KeyT a, KeyT b, ValT y) {
1083
5.94M
    if (branched() || 
rootSize == RootLeaf::Capacity5.18M
)
1084
825k
      return find(a).insert(a, b, y);
1085
5.12M
1086
5.12M
    // Easy insert into root leaf.
1087
5.12M
    unsigned p = rootLeaf().findFrom(0, rootSize, a);
1088
5.12M
    rootSize = rootLeaf().insertFrom(p, rootSize, a, b, y);
1089
5.12M
  }
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::insert(llvm::SlotIndex, llvm::SlotIndex, unsigned int)
Line
Count
Source
1082
2.72M
  void insert(KeyT a, KeyT b, ValT y) {
1083
2.72M
    if (branched() || 
rootSize == RootLeaf::Capacity1.96M
)
1084
824k
      return find(a).insert(a, b, y);
1085
1.89M
1086
1.89M
    // Easy insert into root leaf.
1087
1.89M
    unsigned p = rootLeaf().findFrom(0, rootSize, a);
1088
1.89M
    rootSize = rootLeaf().insertFrom(p, rootSize, a, b, y);
1089
1.89M
  }
DAGCombiner.cpp:llvm::IntervalMap<long long, (anonymous namespace)::UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::insert(long long, long long, (anonymous namespace)::UnitT)
Line
Count
Source
1082
3.22M
  void insert(KeyT a, KeyT b, ValT y) {
1083
3.22M
    if (branched() || 
rootSize == RootLeaf::Capacity3.22M
)
1084
1.33k
      return find(a).insert(a, b, y);
1085
3.22M
1086
3.22M
    // Easy insert into root leaf.
1087
3.22M
    unsigned p = rootLeaf().findFrom(0, rootSize, a);
1088
3.22M
    rootSize = rootLeaf().insertFrom(p, rootSize, a, b, y);
1089
3.22M
  }
1090
1091
  /// clear - Remove all entries.
1092
  void clear();
1093
1094
  class const_iterator;
1095
  class iterator;
1096
  friend class const_iterator;
1097
  friend class iterator;
1098
1099
0
  const_iterator begin() const {
1100
0
    const_iterator I(*this);
1101
0
    I.goToBegin();
1102
0
    return I;
1103
0
  }
1104
1105
463k
  iterator begin() {
1106
463k
    iterator I(*this);
1107
463k
    I.goToBegin();
1108
463k
    return I;
1109
463k
  }
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::begin()
Line
Count
Source
1105
18.3k
  iterator begin() {
1106
18.3k
    iterator I(*this);
1107
18.3k
    I.goToBegin();
1108
18.3k
    return I;
1109
18.3k
  }
Unexecuted instantiation: llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::begin()
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::begin()
Line
Count
Source
1105
198k
  iterator begin() {
1106
198k
    iterator I(*this);
1107
198k
    I.goToBegin();
1108
198k
    return I;
1109
198k
  }
DAGCombiner.cpp:llvm::IntervalMap<long long, (anonymous namespace)::UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::begin()
Line
Count
Source
1105
246k
  iterator begin() {
1106
246k
    iterator I(*this);
1107
246k
    I.goToBegin();
1108
246k
    return I;
1109
246k
  }
1110
1111
  const_iterator end() const {
1112
    const_iterator I(*this);
1113
    I.goToEnd();
1114
    return I;
1115
  }
1116
1117
248k
  iterator end() {
1118
248k
    iterator I(*this);
1119
248k
    I.goToEnd();
1120
248k
    return I;
1121
248k
  }
1122
1123
  /// find - Return an iterator pointing to the first interval ending at or
1124
  /// after x, or end().
1125
0
  const_iterator find(KeyT x) const {
1126
0
    const_iterator I(*this);
1127
0
    I.find(x);
1128
0
    return I;
1129
0
  }
1130
1131
12.7M
  iterator find(KeyT x) {
1132
12.7M
    iterator I(*this);
1133
12.7M
    I.find(x);
1134
12.7M
    return I;
1135
12.7M
  }
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::find(llvm::SlotIndex)
Line
Count
Source
1131
9.62k
  iterator find(KeyT x) {
1132
9.62k
    iterator I(*this);
1133
9.62k
    I.find(x);
1134
9.62k
    return I;
1135
9.62k
  }
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::find(llvm::SlotIndex)
Line
Count
Source
1131
11.6M
  iterator find(KeyT x) {
1132
11.6M
    iterator I(*this);
1133
11.6M
    I.find(x);
1134
11.6M
    return I;
1135
11.6M
  }
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::find(llvm::SlotIndex)
Line
Count
Source
1131
824k
  iterator find(KeyT x) {
1132
824k
    iterator I(*this);
1133
824k
    I.find(x);
1134
824k
    return I;
1135
824k
  }
DAGCombiner.cpp:llvm::IntervalMap<long long, (anonymous namespace)::UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::find(long long)
Line
Count
Source
1131
249k
  iterator find(KeyT x) {
1132
249k
    iterator I(*this);
1133
249k
    I.find(x);
1134
249k
    return I;
1135
249k
  }
1136
1137
  /// overlaps(a, b) - Return true if the intervals in this map overlap with the
1138
  /// interval [a;b].
1139
  bool overlaps(KeyT a, KeyT b) {
1140
    assert(Traits::nonEmpty(a, b));
1141
    const_iterator I = find(a);
1142
    if (!I.valid())
1143
      return false;
1144
    // [a;b] and [x;y] overlap iff x<=b and a<=y. The find() call guarantees the
1145
    // second part (y = find(a).stop()), so it is sufficient to check the first
1146
    // one.
1147
    return !Traits::stopLess(b, I.start());
1148
  }
1149
};
1150
1151
/// treeSafeLookup - Return the mapped value at x or NotFound, assuming a
1152
/// branched root.
1153
template <typename KeyT, typename ValT, unsigned N, typename Traits>
1154
ValT IntervalMap<KeyT, ValT, N, Traits>::
1155
364k
treeSafeLookup(KeyT x, ValT NotFound) const {
1156
364k
  assert(branched() && "treeLookup assumes a branched root");
1157
364k
1158
364k
  IntervalMapImpl::NodeRef NR = rootBranch().safeLookup(x);
1159
384k
  for (unsigned h = height-1; h; 
--h19.8k
)
1160
19.8k
    NR = NR.get<Branch>().safeLookup(x);
1161
364k
  return NR.get<Leaf>().safeLookup(x, NotFound);
1162
364k
}
1163
1164
// branchRoot - Switch from a leaf root to a branched root.
1165
// Return the new (root offset, node offset) corresponding to Position.
1166
template <typename KeyT, typename ValT, unsigned N, typename Traits>
1167
IntervalMapImpl::IdxPair IntervalMap<KeyT, ValT, N, Traits>::
1168
326k
branchRoot(unsigned Position) {
1169
326k
  using namespace IntervalMapImpl;
1170
326k
  // How many external leaf nodes to hold RootLeaf+1?
1171
326k
  const unsigned Nodes = RootLeaf::Capacity / Leaf::Capacity + 1;
1172
326k
1173
326k
  // Compute element distribution among new nodes.
1174
326k
  unsigned size[Nodes];
1175
326k
  IdxPair NewOffset(0, Position);
1176
326k
1177
326k
  // Is is very common for the root node to be smaller than external nodes.
1178
326k
  if (Nodes == 1)
1179
97
    size[0] = rootSize;
1180
325k
  else
1181
325k
    NewOffset = distribute(Nodes, rootSize, Leaf::Capacity,  nullptr, size,
1182
325k
                           Position, true);
1183
326k
1184
326k
  // Allocate new nodes.
1185
326k
  unsigned pos = 0;
1186
326k
  NodeRef node[Nodes];
1187
978k
  for (unsigned n = 0; n != Nodes; 
++n652k
) {
1188
652k
    Leaf *L = newNode<Leaf>();
1189
652k
    L->copy(rootLeaf(), pos, 0, size[n]);
1190
652k
    node[n] = NodeRef(L, size[n]);
1191
652k
    pos += size[n];
1192
652k
  }
1193
326k
1194
326k
  // Destroy the old leaf node, construct branch node instead.
1195
326k
  switchRootToBranch();
1196
978k
  for (unsigned n = 0; n != Nodes; 
++n652k
) {
1197
652k
    rootBranch().stop(n) = node[n].template get<Leaf>().stop(size[n]-1);
1198
652k
    rootBranch().subtree(n) = node[n];
1199
652k
  }
1200
326k
  rootBranchStart() = node[0].template get<Leaf>().start(0);
1201
326k
  rootSize = Nodes;
1202
326k
  return NewOffset;
1203
326k
}
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::branchRoot(unsigned int)
Line
Count
Source
1168
5
branchRoot(unsigned Position) {
1169
5
  using namespace IntervalMapImpl;
1170
5
  // How many external leaf nodes to hold RootLeaf+1?
1171
5
  const unsigned Nodes = RootLeaf::Capacity / Leaf::Capacity + 1;
1172
5
1173
5
  // Compute element distribution among new nodes.
1174
5
  unsigned size[Nodes];
1175
5
  IdxPair NewOffset(0, Position);
1176
5
1177
5
  // Is is very common for the root node to be smaller than external nodes.
1178
5
  if (Nodes == 1)
1179
5
    size[0] = rootSize;
1180
0
  else
1181
0
    NewOffset = distribute(Nodes, rootSize, Leaf::Capacity,  nullptr, size,
1182
0
                           Position, true);
1183
5
1184
5
  // Allocate new nodes.
1185
5
  unsigned pos = 0;
1186
5
  NodeRef node[Nodes];
1187
10
  for (unsigned n = 0; n != Nodes; 
++n5
) {
1188
5
    Leaf *L = newNode<Leaf>();
1189
5
    L->copy(rootLeaf(), pos, 0, size[n]);
1190
5
    node[n] = NodeRef(L, size[n]);
1191
5
    pos += size[n];
1192
5
  }
1193
5
1194
5
  // Destroy the old leaf node, construct branch node instead.
1195
5
  switchRootToBranch();
1196
10
  for (unsigned n = 0; n != Nodes; 
++n5
) {
1197
5
    rootBranch().stop(n) = node[n].template get<Leaf>().stop(size[n]-1);
1198
5
    rootBranch().subtree(n) = node[n];
1199
5
  }
1200
5
  rootBranchStart() = node[0].template get<Leaf>().start(0);
1201
5
  rootSize = Nodes;
1202
5
  return NewOffset;
1203
5
}
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::branchRoot(unsigned int)
Line
Count
Source
1168
309k
branchRoot(unsigned Position) {
1169
309k
  using namespace IntervalMapImpl;
1170
309k
  // How many external leaf nodes to hold RootLeaf+1?
1171
309k
  const unsigned Nodes = RootLeaf::Capacity / Leaf::Capacity + 1;
1172
309k
1173
309k
  // Compute element distribution among new nodes.
1174
309k
  unsigned size[Nodes];
1175
309k
  IdxPair NewOffset(0, Position);
1176
309k
1177
309k
  // Is is very common for the root node to be smaller than external nodes.
1178
309k
  if (Nodes == 1)
1179
0
    size[0] = rootSize;
1180
309k
  else
1181
309k
    NewOffset = distribute(Nodes, rootSize, Leaf::Capacity,  nullptr, size,
1182
309k
                           Position, true);
1183
309k
1184
309k
  // Allocate new nodes.
1185
309k
  unsigned pos = 0;
1186
309k
  NodeRef node[Nodes];
1187
928k
  for (unsigned n = 0; n != Nodes; 
++n619k
) {
1188
619k
    Leaf *L = newNode<Leaf>();
1189
619k
    L->copy(rootLeaf(), pos, 0, size[n]);
1190
619k
    node[n] = NodeRef(L, size[n]);
1191
619k
    pos += size[n];
1192
619k
  }
1193
309k
1194
309k
  // Destroy the old leaf node, construct branch node instead.
1195
309k
  switchRootToBranch();
1196
928k
  for (unsigned n = 0; n != Nodes; 
++n619k
) {
1197
619k
    rootBranch().stop(n) = node[n].template get<Leaf>().stop(size[n]-1);
1198
619k
    rootBranch().subtree(n) = node[n];
1199
619k
  }
1200
309k
  rootBranchStart() = node[0].template get<Leaf>().start(0);
1201
309k
  rootSize = Nodes;
1202
309k
  return NewOffset;
1203
309k
}
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::branchRoot(unsigned int)
Line
Count
Source
1168
16.4k
branchRoot(unsigned Position) {
1169
16.4k
  using namespace IntervalMapImpl;
1170
16.4k
  // How many external leaf nodes to hold RootLeaf+1?
1171
16.4k
  const unsigned Nodes = RootLeaf::Capacity / Leaf::Capacity + 1;
1172
16.4k
1173
16.4k
  // Compute element distribution among new nodes.
1174
16.4k
  unsigned size[Nodes];
1175
16.4k
  IdxPair NewOffset(0, Position);
1176
16.4k
1177
16.4k
  // Is is very common for the root node to be smaller than external nodes.
1178
16.4k
  if (Nodes == 1)
1179
0
    size[0] = rootSize;
1180
16.4k
  else
1181
16.4k
    NewOffset = distribute(Nodes, rootSize, Leaf::Capacity,  nullptr, size,
1182
16.4k
                           Position, true);
1183
16.4k
1184
16.4k
  // Allocate new nodes.
1185
16.4k
  unsigned pos = 0;
1186
16.4k
  NodeRef node[Nodes];
1187
49.2k
  for (unsigned n = 0; n != Nodes; 
++n32.8k
) {
1188
32.8k
    Leaf *L = newNode<Leaf>();
1189
32.8k
    L->copy(rootLeaf(), pos, 0, size[n]);
1190
32.8k
    node[n] = NodeRef(L, size[n]);
1191
32.8k
    pos += size[n];
1192
32.8k
  }
1193
16.4k
1194
16.4k
  // Destroy the old leaf node, construct branch node instead.
1195
16.4k
  switchRootToBranch();
1196
49.2k
  for (unsigned n = 0; n != Nodes; 
++n32.8k
) {
1197
32.8k
    rootBranch().stop(n) = node[n].template get<Leaf>().stop(size[n]-1);
1198
32.8k
    rootBranch().subtree(n) = node[n];
1199
32.8k
  }
1200
16.4k
  rootBranchStart() = node[0].template get<Leaf>().start(0);
1201
16.4k
  rootSize = Nodes;
1202
16.4k
  return NewOffset;
1203
16.4k
}
DAGCombiner.cpp:llvm::IntervalMap<long long, (anonymous namespace)::UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::branchRoot(unsigned int)
Line
Count
Source
1168
92
branchRoot(unsigned Position) {
1169
92
  using namespace IntervalMapImpl;
1170
92
  // How many external leaf nodes to hold RootLeaf+1?
1171
92
  const unsigned Nodes = RootLeaf::Capacity / Leaf::Capacity + 1;
1172
92
1173
92
  // Compute element distribution among new nodes.
1174
92
  unsigned size[Nodes];
1175
92
  IdxPair NewOffset(0, Position);
1176
92
1177
92
  // Is is very common for the root node to be smaller than external nodes.
1178
92
  if (Nodes == 1)
1179
92
    size[0] = rootSize;
1180
0
  else
1181
0
    NewOffset = distribute(Nodes, rootSize, Leaf::Capacity,  nullptr, size,
1182
0
                           Position, true);
1183
92
1184
92
  // Allocate new nodes.
1185
92
  unsigned pos = 0;
1186
92
  NodeRef node[Nodes];
1187
184
  for (unsigned n = 0; n != Nodes; 
++n92
) {
1188
92
    Leaf *L = newNode<Leaf>();
1189
92
    L->copy(rootLeaf(), pos, 0, size[n]);
1190
92
    node[n] = NodeRef(L, size[n]);
1191
92
    pos += size[n];
1192
92
  }
1193
92
1194
92
  // Destroy the old leaf node, construct branch node instead.
1195
92
  switchRootToBranch();
1196
184
  for (unsigned n = 0; n != Nodes; 
++n92
) {
1197
92
    rootBranch().stop(n) = node[n].template get<Leaf>().stop(size[n]-1);
1198
92
    rootBranch().subtree(n) = node[n];
1199
92
  }
1200
92
  rootBranchStart() = node[0].template get<Leaf>().start(0);
1201
92
  rootSize = Nodes;
1202
92
  return NewOffset;
1203
92
}
1204
1205
// splitRoot - Split the current BranchRoot into multiple Branch nodes.
1206
// Return the new (root offset, node offset) corresponding to Position.
1207
template <typename KeyT, typename ValT, unsigned N, typename Traits>
1208
IntervalMapImpl::IdxPair IntervalMap<KeyT, ValT, N, Traits>::
1209
7.47k
splitRoot(unsigned Position) {
1210
7.47k
  using namespace IntervalMapImpl;
1211
7.47k
  // How many external leaf nodes to hold RootBranch+1?
1212
7.47k
  const unsigned Nodes = RootBranch::Capacity / Branch::Capacity + 1;
1213
7.47k
1214
7.47k
  // Compute element distribution among new nodes.
1215
7.47k
  unsigned Size[Nodes];
1216
7.47k
  IdxPair NewOffset(0, Position);
1217
7.47k
1218
7.47k
  // Is is very common for the root node to be smaller than external nodes.
1219
7.47k
  if (Nodes == 1)
1220
7.47k
    Size[0] = rootSize;
1221
0
  else
1222
0
    NewOffset = distribute(Nodes, rootSize, Leaf::Capacity,  nullptr, Size,
1223
0
                           Position, true);
1224
7.47k
1225
7.47k
  // Allocate new nodes.
1226
7.47k
  unsigned Pos = 0;
1227
7.47k
  NodeRef Node[Nodes];
1228
14.9k
  for (unsigned n = 0; n != Nodes; 
++n7.47k
) {
1229
7.47k
    Branch *B = newNode<Branch>();
1230
7.47k
    B->copy(rootBranch(), Pos, 0, Size[n]);
1231
7.47k
    Node[n] = NodeRef(B, Size[n]);
1232
7.47k
    Pos += Size[n];
1233
7.47k
  }
1234
7.47k
1235
14.9k
  for (unsigned n = 0; n != Nodes; 
++n7.47k
) {
1236
7.47k
    rootBranch().stop(n) = Node[n].template get<Branch>().stop(Size[n]-1);
1237
7.47k
    rootBranch().subtree(n) = Node[n];
1238
7.47k
  }
1239
7.47k
  rootSize = Nodes;
1240
7.47k
  ++height;
1241
7.47k
  return NewOffset;
1242
7.47k
}
Unexecuted instantiation: llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::splitRoot(unsigned int)
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::splitRoot(unsigned int)
Line
Count
Source
1209
7.39k
splitRoot(unsigned Position) {
1210
7.39k
  using namespace IntervalMapImpl;
1211
7.39k
  // How many external leaf nodes to hold RootBranch+1?
1212
7.39k
  const unsigned Nodes = RootBranch::Capacity / Branch::Capacity + 1;
1213
7.39k
1214
7.39k
  // Compute element distribution among new nodes.
1215
7.39k
  unsigned Size[Nodes];
1216
7.39k
  IdxPair NewOffset(0, Position);
1217
7.39k
1218
7.39k
  // Is is very common for the root node to be smaller than external nodes.
1219
7.39k
  if (Nodes == 1)
1220
7.39k
    Size[0] = rootSize;
1221
0
  else
1222
0
    NewOffset = distribute(Nodes, rootSize, Leaf::Capacity,  nullptr, Size,
1223
0
                           Position, true);
1224
7.39k
1225
7.39k
  // Allocate new nodes.
1226
7.39k
  unsigned Pos = 0;
1227
7.39k
  NodeRef Node[Nodes];
1228
14.7k
  for (unsigned n = 0; n != Nodes; 
++n7.39k
) {
1229
7.39k
    Branch *B = newNode<Branch>();
1230
7.39k
    B->copy(rootBranch(), Pos, 0, Size[n]);
1231
7.39k
    Node[n] = NodeRef(B, Size[n]);
1232
7.39k
    Pos += Size[n];
1233
7.39k
  }
1234
7.39k
1235
14.7k
  for (unsigned n = 0; n != Nodes; 
++n7.39k
) {
1236
7.39k
    rootBranch().stop(n) = Node[n].template get<Branch>().stop(Size[n]-1);
1237
7.39k
    rootBranch().subtree(n) = Node[n];
1238
7.39k
  }
1239
7.39k
  rootSize = Nodes;
1240
7.39k
  ++height;
1241
7.39k
  return NewOffset;
1242
7.39k
}
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::splitRoot(unsigned int)
Line
Count
Source
1209
81
splitRoot(unsigned Position) {
1210
81
  using namespace IntervalMapImpl;
1211
81
  // How many external leaf nodes to hold RootBranch+1?
1212
81
  const unsigned Nodes = RootBranch::Capacity / Branch::Capacity + 1;
1213
81
1214
81
  // Compute element distribution among new nodes.
1215
81
  unsigned Size[Nodes];
1216
81
  IdxPair NewOffset(0, Position);
1217
81
1218
81
  // Is is very common for the root node to be smaller than external nodes.
1219
81
  if (Nodes == 1)
1220
81
    Size[0] = rootSize;
1221
0
  else
1222
0
    NewOffset = distribute(Nodes, rootSize, Leaf::Capacity,  nullptr, Size,
1223
0
                           Position, true);
1224
81
1225
81
  // Allocate new nodes.
1226
81
  unsigned Pos = 0;
1227
81
  NodeRef Node[Nodes];
1228
162
  for (unsigned n = 0; n != Nodes; 
++n81
) {
1229
81
    Branch *B = newNode<Branch>();
1230
81
    B->copy(rootBranch(), Pos, 0, Size[n]);
1231
81
    Node[n] = NodeRef(B, Size[n]);
1232
81
    Pos += Size[n];
1233
81
  }
1234
81
1235
162
  for (unsigned n = 0; n != Nodes; 
++n81
) {
1236
81
    rootBranch().stop(n) = Node[n].template get<Branch>().stop(Size[n]-1);
1237
81
    rootBranch().subtree(n) = Node[n];
1238
81
  }
1239
81
  rootSize = Nodes;
1240
81
  ++height;
1241
81
  return NewOffset;
1242
81
}
Unexecuted instantiation: DAGCombiner.cpp:llvm::IntervalMap<long long, (anonymous namespace)::UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::splitRoot(unsigned int)
1243
1244
/// visitNodes - Visit each external node.
1245
template <typename KeyT, typename ValT, unsigned N, typename Traits>
1246
void IntervalMap<KeyT, ValT, N, Traits>::
1247
315k
visitNodes(void (IntervalMap::*f)(IntervalMapImpl::NodeRef, unsigned Height)) {
1248
315k
  if (!branched())
1249
0
    return;
1250
315k
  SmallVector<IntervalMapImpl::NodeRef, 4> Refs, NextRefs;
1251
315k
1252
315k
  // Collect level 0 nodes from the root.
1253
1.19M
  for (unsigned i = 0; i != rootSize; 
++i878k
)
1254
878k
    Refs.push_back(rootBranch().subtree(i));
1255
315k
1256
315k
  // Visit all branch nodes.
1257
322k
  for (unsigned h = height - 1; h; 
--h7.37k
) {
1258
26.8k
    for (unsigned i = 0, e = Refs.size(); i != e; 
++i19.5k
) {
1259
204k
      for (unsigned j = 0, s = Refs[i].size(); j != s; 
++j185k
)
1260
185k
        NextRefs.push_back(Refs[i].subtree(j));
1261
19.5k
      (this->*f)(Refs[i], h);
1262
19.5k
    }
1263
7.37k
    Refs.clear();
1264
7.37k
    Refs.swap(NextRefs);
1265
7.37k
  }
1266
315k
1267
315k
  // Visit all leaf nodes.
1268
1.35M
  for (unsigned i = 0, e = Refs.size(); i != e; 
++i1.04M
)
1269
1.04M
    (this->*f)(Refs[i], 0);
1270
315k
}
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::visitNodes(void (llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::*)(llvm::IntervalMapImpl::NodeRef, unsigned int))
Line
Count
Source
1247
5
visitNodes(void (IntervalMap::*f)(IntervalMapImpl::NodeRef, unsigned Height)) {
1248
5
  if (!branched())
1249
0
    return;
1250
5
  SmallVector<IntervalMapImpl::NodeRef, 4> Refs, NextRefs;
1251
5
1252
5
  // Collect level 0 nodes from the root.
1253
10
  for (unsigned i = 0; i != rootSize; 
++i5
)
1254
5
    Refs.push_back(rootBranch().subtree(i));
1255
5
1256
5
  // Visit all branch nodes.
1257
5
  for (unsigned h = height - 1; h; 
--h0
) {
1258
0
    for (unsigned i = 0, e = Refs.size(); i != e; ++i) {
1259
0
      for (unsigned j = 0, s = Refs[i].size(); j != s; ++j)
1260
0
        NextRefs.push_back(Refs[i].subtree(j));
1261
0
      (this->*f)(Refs[i], h);
1262
0
    }
1263
0
    Refs.clear();
1264
0
    Refs.swap(NextRefs);
1265
0
  }
1266
5
1267
5
  // Visit all leaf nodes.
1268
10
  for (unsigned i = 0, e = Refs.size(); i != e; 
++i5
)
1269
5
    (this->*f)(Refs[i], 0);
1270
5
}
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::visitNodes(void (llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::*)(llvm::IntervalMapImpl::NodeRef, unsigned int))
Line
Count
Source
1247
298k
visitNodes(void (IntervalMap::*f)(IntervalMapImpl::NodeRef, unsigned Height)) {
1248
298k
  if (!branched())
1249
0
    return;
1250
298k
  SmallVector<IntervalMapImpl::NodeRef, 4> Refs, NextRefs;
1251
298k
1252
298k
  // Collect level 0 nodes from the root.
1253
1.13M
  for (unsigned i = 0; i != rootSize; 
++i838k
)
1254
838k
    Refs.push_back(rootBranch().subtree(i));
1255
298k
1256
298k
  // Visit all branch nodes.
1257
306k
  for (unsigned h = height - 1; h; 
--h7.29k
) {
1258
26.6k
    for (unsigned i = 0, e = Refs.size(); i != e; 
++i19.3k
) {
1259
202k
      for (unsigned j = 0, s = Refs[i].size(); j != s; 
++j183k
)
1260
183k
        NextRefs.push_back(Refs[i].subtree(j));
1261
19.3k
      (this->*f)(Refs[i], h);
1262
19.3k
    }
1263
7.29k
    Refs.clear();
1264
7.29k
    Refs.swap(NextRefs);
1265
7.29k
  }
1266
298k
1267
298k
  // Visit all leaf nodes.
1268
1.30M
  for (unsigned i = 0, e = Refs.size(); i != e; 
++i1.00M
)
1269
1.00M
    (this->*f)(Refs[i], 0);
1270
298k
}
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::visitNodes(void (llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::*)(llvm::IntervalMapImpl::NodeRef, unsigned int))
Line
Count
Source
1247
16.4k
visitNodes(void (IntervalMap::*f)(IntervalMapImpl::NodeRef, unsigned Height)) {
1248
16.4k
  if (!branched())
1249
0
    return;
1250
16.4k
  SmallVector<IntervalMapImpl::NodeRef, 4> Refs, NextRefs;
1251
16.4k
1252
16.4k
  // Collect level 0 nodes from the root.
1253
55.7k
  for (unsigned i = 0; i != rootSize; 
++i39.3k
)
1254
39.3k
    Refs.push_back(rootBranch().subtree(i));
1255
16.4k
1256
16.4k
  // Visit all branch nodes.
1257
16.4k
  for (unsigned h = height - 1; h; 
--h81
) {
1258
290
    for (unsigned i = 0, e = Refs.size(); i != e; 
++i209
) {
1259
1.97k
      for (unsigned j = 0, s = Refs[i].size(); j != s; 
++j1.76k
)
1260
1.76k
        NextRefs.push_back(Refs[i].subtree(j));
1261
209
      (this->*f)(Refs[i], h);
1262
209
    }
1263
81
    Refs.clear();
1264
81
    Refs.swap(NextRefs);
1265
81
  }
1266
16.4k
1267
16.4k
  // Visit all leaf nodes.
1268
57.3k
  for (unsigned i = 0, e = Refs.size(); i != e; 
++i40.9k
)
1269
40.9k
    (this->*f)(Refs[i], 0);
1270
16.4k
}
DAGCombiner.cpp:llvm::IntervalMap<long long, (anonymous namespace)::UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::visitNodes(void (llvm::IntervalMap<long long, (anonymous namespace)::UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::*)(llvm::IntervalMapImpl::NodeRef, unsigned int))
Line
Count
Source
1247
92
visitNodes(void (IntervalMap::*f)(IntervalMapImpl::NodeRef, unsigned Height)) {
1248
92
  if (!branched())
1249
0
    return;
1250
92
  SmallVector<IntervalMapImpl::NodeRef, 4> Refs, NextRefs;
1251
92
1252
92
  // Collect level 0 nodes from the root.
1253
268
  for (unsigned i = 0; i != rootSize; 
++i176
)
1254
176
    Refs.push_back(rootBranch().subtree(i));
1255
92
1256
92
  // Visit all branch nodes.
1257
92
  for (unsigned h = height - 1; h; 
--h0
) {
1258
0
    for (unsigned i = 0, e = Refs.size(); i != e; ++i) {
1259
0
      for (unsigned j = 0, s = Refs[i].size(); j != s; ++j)
1260
0
        NextRefs.push_back(Refs[i].subtree(j));
1261
0
      (this->*f)(Refs[i], h);
1262
0
    }
1263
0
    Refs.clear();
1264
0
    Refs.swap(NextRefs);
1265
0
  }
1266
92
1267
92
  // Visit all leaf nodes.
1268
268
  for (unsigned i = 0, e = Refs.size(); i != e; 
++i176
)
1269
176
    (this->*f)(Refs[i], 0);
1270
92
}
1271
1272
template <typename KeyT, typename ValT, unsigned N, typename Traits>
1273
void IntervalMap<KeyT, ValT, N, Traits>::
1274
1.06M
deleteNode(IntervalMapImpl::NodeRef Node, unsigned Level) {
1275
1.06M
  if (Level)
1276
19.5k
    deleteNode(&Node.get<Branch>());
1277
1.04M
  else
1278
1.04M
    deleteNode(&Node.get<Leaf>());
1279
1.06M
}
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::deleteNode(llvm::IntervalMapImpl::NodeRef, unsigned int)
Line
Count
Source
1274
5
deleteNode(IntervalMapImpl::NodeRef Node, unsigned Level) {
1275
5
  if (Level)
1276
0
    deleteNode(&Node.get<Branch>());
1277
5
  else
1278
5
    deleteNode(&Node.get<Leaf>());
1279
5
}
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::deleteNode(llvm::IntervalMapImpl::NodeRef, unsigned int)
Line
Count
Source
1274
1.02M
deleteNode(IntervalMapImpl::NodeRef Node, unsigned Level) {
1275
1.02M
  if (Level)
1276
19.3k
    deleteNode(&Node.get<Branch>());
1277
1.00M
  else
1278
1.00M
    deleteNode(&Node.get<Leaf>());
1279
1.02M
}
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::deleteNode(llvm::IntervalMapImpl::NodeRef, unsigned int)
Line
Count
Source
1274
41.1k
deleteNode(IntervalMapImpl::NodeRef Node, unsigned Level) {
1275
41.1k
  if (Level)
1276
209
    deleteNode(&Node.get<Branch>());
1277
40.9k
  else
1278
40.9k
    deleteNode(&Node.get<Leaf>());
1279
41.1k
}
DAGCombiner.cpp:llvm::IntervalMap<long long, (anonymous namespace)::UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::deleteNode(llvm::IntervalMapImpl::NodeRef, unsigned int)
Line
Count
Source
1274
176
deleteNode(IntervalMapImpl::NodeRef Node, unsigned Level) {
1275
176
  if (Level)
1276
0
    deleteNode(&Node.get<Branch>());
1277
176
  else
1278
176
    deleteNode(&Node.get<Leaf>());
1279
176
}
1280
1281
template <typename KeyT, typename ValT, unsigned N, typename Traits>
1282
void IntervalMap<KeyT, ValT, N, Traits>::
1283
79.9M
clear() {
1284
79.9M
  if (branched()) {
1285
315k
    visitNodes(&IntervalMap::deleteNode);
1286
315k
    switchRootToLeaf();
1287
315k
  }
1288
79.9M
  rootSize = 0;
1289
79.9M
}
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::clear()
Line
Count
Source
1283
4.60k
clear() {
1284
4.60k
  if (branched()) {
1285
5
    visitNodes(&IntervalMap::deleteNode);
1286
5
    switchRootToLeaf();
1287
5
  }
1288
4.60k
  rootSize = 0;
1289
4.60k
}
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::clear()
Line
Count
Source
1283
76.1M
clear() {
1284
76.1M
  if (branched()) {
1285
298k
    visitNodes(&IntervalMap::deleteNode);
1286
298k
    switchRootToLeaf();
1287
298k
  }
1288
76.1M
  rootSize = 0;
1289
76.1M
}
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::clear()
Line
Count
Source
1283
806k
clear() {
1284
806k
  if (branched()) {
1285
16.4k
    visitNodes(&IntervalMap::deleteNode);
1286
16.4k
    switchRootToLeaf();
1287
16.4k
  }
1288
806k
  rootSize = 0;
1289
806k
}
DAGCombiner.cpp:llvm::IntervalMap<long long, (anonymous namespace)::UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::clear()
Line
Count
Source
1283
3.00M
clear() {
1284
3.00M
  if (branched()) {
1285
92
    visitNodes(&IntervalMap::deleteNode);
1286
92
    switchRootToLeaf();
1287
92
  }
1288
3.00M
  rootSize = 0;
1289
3.00M
}
1290
1291
//===----------------------------------------------------------------------===//
1292
//---                   IntervalMap::const_iterator                       ----//
1293
//===----------------------------------------------------------------------===//
1294
1295
template <typename KeyT, typename ValT, unsigned N, typename Traits>
1296
class IntervalMap<KeyT, ValT, N, Traits>::const_iterator :
1297
  public std::iterator<std::bidirectional_iterator_tag, ValT> {
1298
1299
protected:
1300
  friend class IntervalMap;
1301
1302
  // The map referred to.
1303
  IntervalMap *map = nullptr;
1304
1305
  // We store a full path from the root to the current position.
1306
  // The path may be partially filled, but never between iterator calls.
1307
  IntervalMapImpl::Path path;
1308
1309
  explicit const_iterator(const IntervalMap &map) :
1310
13.4M
    map(const_cast<IntervalMap*>(&map)) {}
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::const_iterator(llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> > const&)
Line
Count
Source
1310
28.0k
    map(const_cast<IntervalMap*>(&map)) {}
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::const_iterator(llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> > const&)
Line
Count
Source
1310
11.6M
    map(const_cast<IntervalMap*>(&map)) {}
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::const_iterator(llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> > const&)
Line
Count
Source
1310
1.02M
    map(const_cast<IntervalMap*>(&map)) {}
DAGCombiner.cpp:llvm::IntervalMap<long long, (anonymous namespace)::UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::const_iterator::const_iterator(llvm::IntervalMap<long long, (anonymous namespace)::UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> > const&)
Line
Count
Source
1310
744k
    map(const_cast<IntervalMap*>(&map)) {}
1311
1312
1.19G
  bool branched() const {
1313
1.19G
    assert(map && "Invalid iterator");
1314
1.19G
    return map->branched();
1315
1.19G
  }
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::branched() const
Line
Count
Source
1312
1.19G
  bool branched() const {
1313
1.19G
    assert(map && "Invalid iterator");
1314
1.19G
    return map->branched();
1315
1.19G
  }
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::branched() const
Line
Count
Source
1312
165k
  bool branched() const {
1313
165k
    assert(map && "Invalid iterator");
1314
165k
    return map->branched();
1315
165k
  }
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::branched() const
Line
Count
Source
1312
7.44M
  bool branched() const {
1313
7.44M
    assert(map && "Invalid iterator");
1314
7.44M
    return map->branched();
1315
7.44M
  }
DAGCombiner.cpp:llvm::IntervalMap<long long, (anonymous namespace)::UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::const_iterator::branched() const
Line
Count
Source
1312
1.51M
  bool branched() const {
1313
1.51M
    assert(map && "Invalid iterator");
1314
1.51M
    return map->branched();
1315
1.51M
  }
1316
1317
162M
  void setRoot(unsigned Offset) {
1318
162M
    if (branched())
1319
36.4M
      path.setRoot(&map->rootBranch(), map->rootSize, Offset);
1320
125M
    else
1321
125M
      path.setRoot(&map->rootLeaf(), map->rootSize, Offset);
1322
162M
  }
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::setRoot(unsigned int)
Line
Count
Source
1317
160M
  void setRoot(unsigned Offset) {
1318
160M
    if (branched())
1319
35.6M
      path.setRoot(&map->rootBranch(), map->rootSize, Offset);
1320
124M
    else
1321
124M
      path.setRoot(&map->rootLeaf(), map->rootSize, Offset);
1322
160M
  }
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::setRoot(unsigned int)
Line
Count
Source
1317
28.0k
  void setRoot(unsigned Offset) {
1318
28.0k
    if (branched())
1319
114
      path.setRoot(&map->rootBranch(), map->rootSize, Offset);
1320
27.9k
    else
1321
27.9k
      path.setRoot(&map->rootLeaf(), map->rootSize, Offset);
1322
28.0k
  }
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::setRoot(unsigned int)
Line
Count
Source
1317
1.08M
  void setRoot(unsigned Offset) {
1318
1.08M
    if (branched())
1319
806k
      path.setRoot(&map->rootBranch(), map->rootSize, Offset);
1320
281k
    else
1321
281k
      path.setRoot(&map->rootLeaf(), map->rootSize, Offset);
1322
1.08M
  }
DAGCombiner.cpp:llvm::IntervalMap<long long, (anonymous namespace)::UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::const_iterator::setRoot(unsigned int)
Line
Count
Source
1317
744k
  void setRoot(unsigned Offset) {
1318
744k
    if (branched())
1319
4.43k
      path.setRoot(&map->rootBranch(), map->rootSize, Offset);
1320
740k
    else
1321
740k
      path.setRoot(&map->rootLeaf(), map->rootSize, Offset);
1322
744k
  }
1323
1324
  void pathFillFind(KeyT x);
1325
  void treeFind(KeyT x);
1326
  void treeAdvanceTo(KeyT x);
1327
1328
  /// unsafeStart - Writable access to start() for iterator.
1329
359M
  KeyT &unsafeStart() const {
1330
359M
    assert(valid() && "Cannot access invalid iterator");
1331
359M
    return branched() ? 
path.leaf<Leaf>().start(path.leafOffset())129M
:
1332
359M
                        
path.leaf<RootLeaf>().start(path.leafOffset())229M
;
1333
359M
  }
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::unsafeStart() const
Line
Count
Source
1329
357M
  KeyT &unsafeStart() const {
1330
357M
    assert(valid() && "Cannot access invalid iterator");
1331
357M
    return branched() ? 
path.leaf<Leaf>().start(path.leafOffset())129M
:
1332
357M
                        
path.leaf<RootLeaf>().start(path.leafOffset())228M
;
1333
357M
  }
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::unsafeStart() const
Line
Count
Source
1329
33.2k
  KeyT &unsafeStart() const {
1330
33.2k
    assert(valid() && "Cannot access invalid iterator");
1331
33.2k
    return branched() ? 
path.leaf<Leaf>().start(path.leafOffset())192
:
1332
33.2k
                        
path.leaf<RootLeaf>().start(path.leafOffset())33.0k
;
1333
33.2k
  }
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::unsafeStart() const
Line
Count
Source
1329
1.73M
  KeyT &unsafeStart() const {
1330
1.73M
    assert(valid() && "Cannot access invalid iterator");
1331
1.73M
    return branched() ? 
path.leaf<Leaf>().start(path.leafOffset())524k
:
1332
1.73M
                        
path.leaf<RootLeaf>().start(path.leafOffset())1.20M
;
1333
1.73M
  }
DAGCombiner.cpp:llvm::IntervalMap<long long, (anonymous namespace)::UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::const_iterator::unsafeStart() const
Line
Count
Source
1329
229k
  KeyT &unsafeStart() const {
1330
229k
    assert(valid() && "Cannot access invalid iterator");
1331
229k
    return branched() ? 
path.leaf<Leaf>().start(path.leafOffset())1.10k
:
1332
229k
                        
path.leaf<RootLeaf>().start(path.leafOffset())227k
;
1333
229k
  }
1334
1335
  /// unsafeStop - Writable access to stop() for iterator.
1336
276M
  KeyT &unsafeStop() const {
1337
276M
    assert(valid() && "Cannot access invalid iterator");
1338
276M
    return branched() ? 
path.leaf<Leaf>().stop(path.leafOffset())76.8M
:
1339
276M
                        
path.leaf<RootLeaf>().stop(path.leafOffset())199M
;
1340
276M
  }
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::unsafeStop() const
Line
Count
Source
1336
275M
  KeyT &unsafeStop() const {
1337
275M
    assert(valid() && "Cannot access invalid iterator");
1338
275M
    return branched() ? 
path.leaf<Leaf>().stop(path.leafOffset())76.5M
:
1339
275M
                        
path.leaf<RootLeaf>().stop(path.leafOffset())198M
;
1340
275M
  }
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::unsafeStop() const
Line
Count
Source
1336
9.74k
  KeyT &unsafeStop() const {
1337
9.74k
    assert(valid() && "Cannot access invalid iterator");
1338
9.74k
    return branched() ? 
path.leaf<Leaf>().stop(path.leafOffset())67
:
1339
9.74k
                        
path.leaf<RootLeaf>().stop(path.leafOffset())9.67k
;
1340
9.74k
  }
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::unsafeStop() const
Line
Count
Source
1336
1.23M
  KeyT &unsafeStop() const {
1337
1.23M
    assert(valid() && "Cannot access invalid iterator");
1338
1.23M
    return branched() ? 
path.leaf<Leaf>().stop(path.leafOffset())344k
:
1339
1.23M
                        
path.leaf<RootLeaf>().stop(path.leafOffset())892k
;
1340
1.23M
  }
DAGCombiner.cpp:llvm::IntervalMap<long long, (anonymous namespace)::UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::const_iterator::unsafeStop() const
Line
Count
Source
1336
23.1k
  KeyT &unsafeStop() const {
1337
23.1k
    assert(valid() && "Cannot access invalid iterator");
1338
23.1k
    return branched() ? 
path.leaf<Leaf>().stop(path.leafOffset())3
:
1339
23.1k
                        
path.leaf<RootLeaf>().stop(path.leafOffset())23.1k
;
1340
23.1k
  }
1341
1342
  /// unsafeValue - Writable access to value() for iterator.
1343
178M
  ValT &unsafeValue() const {
1344
178M
    assert(valid() && "Cannot access invalid iterator");
1345
178M
    return branched() ? 
path.leaf<Leaf>().value(path.leafOffset())54.0M
:
1346
178M
                        
path.leaf<RootLeaf>().value(path.leafOffset())124M
;
1347
178M
  }
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::unsafeValue() const
Line
Count
Source
1343
29.2k
  ValT &unsafeValue() const {
1344
29.2k
    assert(valid() && "Cannot access invalid iterator");
1345
29.2k
    return branched() ? 
path.leaf<Leaf>().value(path.leafOffset())229
:
1346
29.2k
                        
path.leaf<RootLeaf>().value(path.leafOffset())29.0k
;
1347
29.2k
  }
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::unsafeValue() const
Line
Count
Source
1343
177M
  ValT &unsafeValue() const {
1344
177M
    assert(valid() && "Cannot access invalid iterator");
1345
177M
    return branched() ? 
path.leaf<Leaf>().value(path.leafOffset())53.8M
:
1346
177M
                        
path.leaf<RootLeaf>().value(path.leafOffset())123M
;
1347
177M
  }
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::unsafeValue() const
Line
Count
Source
1343
791k
  ValT &unsafeValue() const {
1344
791k
    assert(valid() && "Cannot access invalid iterator");
1345
791k
    return branched() ? 
path.leaf<Leaf>().value(path.leafOffset())225k
:
1346
791k
                        
path.leaf<RootLeaf>().value(path.leafOffset())566k
;
1347
791k
  }
1348
1349
public:
1350
  /// const_iterator - Create an iterator that isn't pointing anywhere.
1351
96.1M
  const_iterator() = default;
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::const_iterator()
Line
Count
Source
1351
95.9M
  const_iterator() = default;
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::const_iterator()
Line
Count
Source
1351
15
  const_iterator() = default;
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::const_iterator()
Line
Count
Source
1351
164k
  const_iterator() = default;
1352
1353
  /// setMap - Change the map iterated over. This call must be followed by a
1354
  /// call to goToBegin(), goToEnd(), or find()
1355
136M
  void setMap(const IntervalMap &m) { map = const_cast<IntervalMap*>(&m); }
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::setMap(llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> > const&)
Line
Count
Source
1355
136M
  void setMap(const IntervalMap &m) { map = const_cast<IntervalMap*>(&m); }
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::setMap(llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> > const&)
Line
Count
Source
1355
15
  void setMap(const IntervalMap &m) { map = const_cast<IntervalMap*>(&m); }
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::setMap(llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> > const&)
Line
Count
Source
1355
164k
  void setMap(const IntervalMap &m) { map = const_cast<IntervalMap*>(&m); }
1356
1357
  /// valid - Return true if the current position is valid, false for end().
1358
457M
  bool valid() const { return path.valid(); }
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::valid() const
Line
Count
Source
1358
454M
  bool valid() const { return path.valid(); }
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::valid() const
Line
Count
Source
1358
61.1k
  bool valid() const { return path.valid(); }
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::valid() const
Line
Count
Source
1358
2.93M
  bool valid() const { return path.valid(); }
DAGCombiner.cpp:llvm::IntervalMap<long long, (anonymous namespace)::UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::const_iterator::valid() const
Line
Count
Source
1358
559k
  bool valid() const { return path.valid(); }
1359
1360
  /// atBegin - Return true if the current position is the first map entry.
1361
  bool atBegin() const { return path.atBegin(); }
1362
1363
  /// start - Return the beginning of the current interval.
1364
359M
  const KeyT &start() const { return unsafeStart(); }
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::start() const
Line
Count
Source
1364
357M
  const KeyT &start() const { return unsafeStart(); }
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::start() const
Line
Count
Source
1364
24.1k
  const KeyT &start() const { return unsafeStart(); }
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::start() const
Line
Count
Source
1364
1.73M
  const KeyT &start() const { return unsafeStart(); }
DAGCombiner.cpp:llvm::IntervalMap<long long, (anonymous namespace)::UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::const_iterator::start() const
Line
Count
Source
1364
229k
  const KeyT &start() const { return unsafeStart(); }
1365
1366
  /// stop - Return the end of the current interval.
1367
276M
  const KeyT &stop() const { return unsafeStop(); }
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::stop() const
Line
Count
Source
1367
275M
  const KeyT &stop() const { return unsafeStop(); }
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::stop() const
Line
Count
Source
1367
9.69k
  const KeyT &stop() const { return unsafeStop(); }
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::stop() const
Line
Count
Source
1367
1.23M
  const KeyT &stop() const { return unsafeStop(); }
DAGCombiner.cpp:llvm::IntervalMap<long long, (anonymous namespace)::UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::const_iterator::stop() const
Line
Count
Source
1367
23.1k
  const KeyT &stop() const { return unsafeStop(); }
1368
1369
  /// value - Return the mapped value at the current interval.
1370
178M
  const ValT &value() const { return unsafeValue(); }
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::value() const
Line
Count
Source
1370
24.3k
  const ValT &value() const { return unsafeValue(); }
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::value() const
Line
Count
Source
1370
177M
  const ValT &value() const { return unsafeValue(); }
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::value() const
Line
Count
Source
1370
791k
  const ValT &value() const { return unsafeValue(); }
1371
1372
  const ValT &operator*() const { return value(); }
1373
1374
494k
  bool operator==(const const_iterator &RHS) const {
1375
494k
    assert(map == RHS.map && "Cannot compare iterators from different maps");
1376
494k
    if (!valid())
1377
38.7k
      return !RHS.valid();
1378
456k
    if (path.leafOffset() != RHS.path.leafOffset())
1379
232k
      return false;
1380
223k
    return &path.template leaf<Leaf>() == &RHS.path.template leaf<Leaf>();
1381
223k
  }
1382
1383
494k
  bool operator!=(const const_iterator &RHS) const {
1384
494k
    return !operator==(RHS);
1385
494k
  }
1386
1387
  /// goToBegin - Move to the first interval in map.
1388
463k
  void goToBegin() {
1389
463k
    setRoot(0);
1390
463k
    if (branched())
1391
17.5k
      path.fillLeft(map->height);
1392
463k
  }
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::goToBegin()
Line
Count
Source
1388
18.4k
  void goToBegin() {
1389
18.4k
    setRoot(0);
1390
18.4k
    if (branched())
1391
19
      path.fillLeft(map->height);
1392
18.4k
  }
Unexecuted instantiation: llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::goToBegin()
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::goToBegin()
Line
Count
Source
1388
198k
  void goToBegin() {
1389
198k
    setRoot(0);
1390
198k
    if (branched())
1391
16.4k
      path.fillLeft(map->height);
1392
198k
  }
DAGCombiner.cpp:llvm::IntervalMap<long long, (anonymous namespace)::UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::const_iterator::goToBegin()
Line
Count
Source
1388
246k
  void goToBegin() {
1389
246k
    setRoot(0);
1390
246k
    if (branched())
1391
1.10k
      path.fillLeft(map->height);
1392
246k
  }
1393
1394
  /// goToEnd - Move beyond the last interval in map.
1395
248k
  void goToEnd() {
1396
248k
    setRoot(map->rootSize);
1397
248k
  }
1398
1399
  /// preincrement - move to the next interval.
1400
61.5M
  const_iterator &operator++() {
1401
61.5M
    assert(valid() && "Cannot increment end()");
1402
61.5M
    if (++path.leafOffset() == path.leafSize() && 
branched()16.4M
)
1403
6.38M
      path.moveRight(map->height);
1404
61.5M
    return *this;
1405
61.5M
  }
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::operator++()
Line
Count
Source
1400
61.1M
  const_iterator &operator++() {
1401
61.1M
    assert(valid() && "Cannot increment end()");
1402
61.1M
    if (++path.leafOffset() == path.leafSize() && 
branched()16.3M
)
1403
6.36M
      path.moveRight(map->height);
1404
61.1M
    return *this;
1405
61.1M
  }
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::operator++()
Line
Count
Source
1400
19.3k
  const_iterator &operator++() {
1401
19.3k
    assert(valid() && "Cannot increment end()");
1402
19.3k
    if (++path.leafOffset() == path.leafSize() && 
branched()18.3k
)
1403
22
      path.moveRight(map->height);
1404
19.3k
    return *this;
1405
19.3k
  }
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::operator++()
Line
Count
Source
1400
424k
  const_iterator &operator++() {
1401
424k
    assert(valid() && "Cannot increment end()");
1402
424k
    if (++path.leafOffset() == path.leafSize() && 
branched()110k
)
1403
19.1k
      path.moveRight(map->height);
1404
424k
    return *this;
1405
424k
  }
1406
1407
  /// postincrement - Dont do that!
1408
  const_iterator operator++(int) {
1409
    const_iterator tmp = *this;
1410
    operator++();
1411
    return tmp;
1412
  }
1413
1414
  /// predecrement - move to the previous interval.
1415
5.72M
  const_iterator &operator--() {
1416
5.72M
    if (path.leafOffset() && 
(5.28M
valid()5.28M
||
!branched()988k
))
1417
5.01M
      --path.leafOffset();
1418
711k
    else
1419
711k
      path.moveLeft(map->height);
1420
5.72M
    return *this;
1421
5.72M
  }
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::operator--()
Line
Count
Source
1415
5.69M
  const_iterator &operator--() {
1416
5.69M
    if (path.leafOffset() && 
(5.26M
valid()5.26M
||
!branched()968k
))
1417
4.98M
      --path.leafOffset();
1418
711k
    else
1419
711k
      path.moveLeft(map->height);
1420
5.69M
    return *this;
1421
5.69M
  }
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::operator--()
Line
Count
Source
1415
12
  const_iterator &operator--() {
1416
12
    if (path.leafOffset() && (valid() || 
!branched()0
))
1417
12
      --path.leafOffset();
1418
0
    else
1419
0
      path.moveLeft(map->height);
1420
12
    return *this;
1421
12
  }
DAGCombiner.cpp:llvm::IntervalMap<long long, (anonymous namespace)::UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::const_iterator::operator--()
Line
Count
Source
1415
23.1k
  const_iterator &operator--() {
1416
23.1k
    if (path.leafOffset() && (valid() || 
!branched()19.3k
))
1417
23.1k
      --path.leafOffset();
1418
2
    else
1419
2
      path.moveLeft(map->height);
1420
23.1k
    return *this;
1421
23.1k
  }
1422
1423
  /// postdecrement - Dont do that!
1424
  const_iterator operator--(int) {
1425
    const_iterator tmp = *this;
1426
    operator--();
1427
    return tmp;
1428
  }
1429
1430
  /// find - Move to the first interval with stop >= x, or end().
1431
  /// This is a full search from the root, the current position is ignored.
1432
158M
  void find(KeyT x) {
1433
158M
    if (branched())
1434
33.4M
      treeFind(x);
1435
125M
    else
1436
125M
      setRoot(map->rootLeaf().findFrom(0, map->rootSize, x));
1437
158M
  }
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::find(llvm::SlotIndex)
Line
Count
Source
1432
157M
  void find(KeyT x) {
1433
157M
    if (branched())
1434
32.6M
      treeFind(x);
1435
124M
    else
1436
124M
      setRoot(map->rootLeaf().findFrom(0, map->rootSize, x));
1437
157M
  }
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::find(llvm::SlotIndex)
Line
Count
Source
1432
9.65k
  void find(KeyT x) {
1433
9.65k
    if (branched())
1434
91
      treeFind(x);
1435
9.56k
    else
1436
9.56k
      setRoot(map->rootLeaf().findFrom(0, map->rootSize, x));
1437
9.65k
  }
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::find(llvm::SlotIndex)
Line
Count
Source
1432
881k
  void find(KeyT x) {
1433
881k
    if (branched())
1434
781k
      treeFind(x);
1435
99.6k
    else
1436
99.6k
      setRoot(map->rootLeaf().findFrom(0, map->rootSize, x));
1437
881k
  }
DAGCombiner.cpp:llvm::IntervalMap<long long, (anonymous namespace)::UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::const_iterator::find(long long)
Line
Count
Source
1432
249k
  void find(KeyT x) {
1433
249k
    if (branched())
1434
2.21k
      treeFind(x);
1435
247k
    else
1436
247k
      setRoot(map->rootLeaf().findFrom(0, map->rootSize, x));
1437
249k
  }
1438
1439
  /// advanceTo - Move to the first interval with stop >= x, or end().
1440
  /// The search is started from the current position, and no earlier positions
1441
  /// can be found. This is much faster than find() for small moves.
1442
35.5M
  void advanceTo(KeyT x) {
1443
35.5M
    if (!valid())
1444
7.54M
      return;
1445
28.0M
    if (branched())
1446
15.0M
      treeAdvanceTo(x);
1447
12.9M
    else
1448
12.9M
      path.leafOffset() =
1449
12.9M
        map->rootLeaf().findFrom(path.leafOffset(), map->rootSize, x);
1450
28.0M
  }
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::advanceTo(llvm::SlotIndex)
Line
Count
Source
1442
34.8M
  void advanceTo(KeyT x) {
1443
34.8M
    if (!valid())
1444
7.45M
      return;
1445
27.4M
    if (branched())
1446
14.9M
      treeAdvanceTo(x);
1447
12.5M
    else
1448
12.5M
      path.leafOffset() =
1449
12.5M
        map->rootLeaf().findFrom(path.leafOffset(), map->rootSize, x);
1450
27.4M
  }
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::advanceTo(llvm::SlotIndex)
Line
Count
Source
1442
9.09k
  void advanceTo(KeyT x) {
1443
9.09k
    if (!valid())
1444
2
      return;
1445
9.08k
    if (branched())
1446
8
      treeAdvanceTo(x);
1447
9.08k
    else
1448
9.08k
      path.leafOffset() =
1449
9.08k
        map->rootLeaf().findFrom(path.leafOffset(), map->rootSize, x);
1450
9.08k
  }
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::advanceTo(llvm::SlotIndex)
Line
Count
Source
1442
676k
  void advanceTo(KeyT x) {
1443
676k
    if (!valid())
1444
94.8k
      return;
1445
582k
    if (branched())
1446
138k
      treeAdvanceTo(x);
1447
443k
    else
1448
443k
      path.leafOffset() =
1449
443k
        map->rootLeaf().findFrom(path.leafOffset(), map->rootSize, x);
1450
582k
  }
1451
};
1452
1453
/// pathFillFind - Complete path by searching for x.
1454
/// @param x Key to search for.
1455
template <typename KeyT, typename ValT, unsigned N, typename Traits>
1456
void IntervalMap<KeyT, ValT, N, Traits>::
1457
34.3M
const_iterator::pathFillFind(KeyT x) {
1458
34.3M
  IntervalMapImpl::NodeRef NR = path.subtree(path.height());
1459
38.2M
  for (unsigned i = map->height - path.height() - 1; i; 
--i3.89M
) {
1460
3.89M
    unsigned p = NR.get<Branch>().safeFind(0, x);
1461
3.89M
    path.push(NR, p);
1462
3.89M
    NR = NR.subtree(p);
1463
3.89M
  }
1464
34.3M
  path.push(NR, NR.get<Leaf>().safeFind(0, x));
1465
34.3M
}
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::pathFillFind(llvm::SlotIndex)
Line
Count
Source
1457
33.6M
const_iterator::pathFillFind(KeyT x) {
1458
33.6M
  IntervalMapImpl::NodeRef NR = path.subtree(path.height());
1459
37.4M
  for (unsigned i = map->height - path.height() - 1; i; 
--i3.87M
) {
1460
3.87M
    unsigned p = NR.get<Branch>().safeFind(0, x);
1461
3.87M
    path.push(NR, p);
1462
3.87M
    NR = NR.subtree(p);
1463
3.87M
  }
1464
33.6M
  path.push(NR, NR.get<Leaf>().safeFind(0, x));
1465
33.6M
}
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::pathFillFind(llvm::SlotIndex)
Line
Count
Source
1457
84
const_iterator::pathFillFind(KeyT x) {
1458
84
  IntervalMapImpl::NodeRef NR = path.subtree(path.height());
1459
84
  for (unsigned i = map->height - path.height() - 1; i; 
--i0
) {
1460
0
    unsigned p = NR.get<Branch>().safeFind(0, x);
1461
0
    path.push(NR, p);
1462
0
    NR = NR.subtree(p);
1463
0
  }
1464
84
  path.push(NR, NR.get<Leaf>().safeFind(0, x));
1465
84
}
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::pathFillFind(llvm::SlotIndex)
Line
Count
Source
1457
738k
const_iterator::pathFillFind(KeyT x) {
1458
738k
  IntervalMapImpl::NodeRef NR = path.subtree(path.height());
1459
763k
  for (unsigned i = map->height - path.height() - 1; i; 
--i25.1k
) {
1460
25.1k
    unsigned p = NR.get<Branch>().safeFind(0, x);
1461
25.1k
    path.push(NR, p);
1462
25.1k
    NR = NR.subtree(p);
1463
25.1k
  }
1464
738k
  path.push(NR, NR.get<Leaf>().safeFind(0, x));
1465
738k
}
DAGCombiner.cpp:llvm::IntervalMap<long long, (anonymous namespace)::UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::const_iterator::pathFillFind(long long)
Line
Count
Source
1457
2.21k
const_iterator::pathFillFind(KeyT x) {
1458
2.21k
  IntervalMapImpl::NodeRef NR = path.subtree(path.height());
1459
2.21k
  for (unsigned i = map->height - path.height() - 1; i; 
--i0
) {
1460
0
    unsigned p = NR.get<Branch>().safeFind(0, x);
1461
0
    path.push(NR, p);
1462
0
    NR = NR.subtree(p);
1463
0
  }
1464
2.21k
  path.push(NR, NR.get<Leaf>().safeFind(0, x));
1465
2.21k
}
1466
1467
/// treeFind - Find in a branched tree.
1468
/// @param x Key to search for.
1469
template <typename KeyT, typename ValT, unsigned N, typename Traits>
1470
void IntervalMap<KeyT, ValT, N, Traits>::
1471
33.4M
const_iterator::treeFind(KeyT x) {
1472
33.4M
  setRoot(map->rootBranch().findFrom(0, map->rootSize, x));
1473
33.4M
  if (valid())
1474
31.3M
    pathFillFind(x);
1475
33.4M
}
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::treeFind(llvm::SlotIndex)
Line
Count
Source
1471
32.6M
const_iterator::treeFind(KeyT x) {
1472
32.6M
  setRoot(map->rootBranch().findFrom(0, map->rootSize, x));
1473
32.6M
  if (valid())
1474
30.6M
    pathFillFind(x);
1475
32.6M
}
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::treeFind(llvm::SlotIndex)
Line
Count
Source
1471
91
const_iterator::treeFind(KeyT x) {
1472
91
  setRoot(map->rootBranch().findFrom(0, map->rootSize, x));
1473
91
  if (valid())
1474
84
    pathFillFind(x);
1475
91
}
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::treeFind(llvm::SlotIndex)
Line
Count
Source
1471
781k
const_iterator::treeFind(KeyT x) {
1472
781k
  setRoot(map->rootBranch().findFrom(0, map->rootSize, x));
1473
781k
  if (valid())
1474
731k
    pathFillFind(x);
1475
781k
}
DAGCombiner.cpp:llvm::IntervalMap<long long, (anonymous namespace)::UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::const_iterator::treeFind(long long)
Line
Count
Source
1471
2.21k
const_iterator::treeFind(KeyT x) {
1472
2.21k
  setRoot(map->rootBranch().findFrom(0, map->rootSize, x));
1473
2.21k
  if (valid())
1474
2.21k
    pathFillFind(x);
1475
2.21k
}
1476
1477
/// treeAdvanceTo - Find position after the current one.
1478
/// @param x Key to search for.
1479
template <typename KeyT, typename ValT, unsigned N, typename Traits>
1480
void IntervalMap<KeyT, ValT, N, Traits>::
1481
15.0M
const_iterator::treeAdvanceTo(KeyT x) {
1482
15.0M
  // Can we stay on the same leaf node?
1483
15.0M
  if (!Traits::stopLess(path.leaf<Leaf>().stop(path.leafSize() - 1), x)) {
1484
11.4M
    path.leafOffset() = path.leaf<Leaf>().safeFind(path.leafOffset(), x);
1485
11.4M
    return;
1486
11.4M
  }
1487
3.62M
1488
3.62M
  // Drop the current leaf.
1489
3.62M
  path.pop();
1490
3.62M
1491
3.62M
  // Search towards the root for a usable subtree.
1492
3.62M
  if (path.height()) {
1493
871k
    for (unsigned l = path.height() - 1; l; 
--l14.1k
) {
1494
41.9k
      if (!Traits::stopLess(path.node<Branch>(l).stop(path.offset(l)), x)) {
1495
27.8k
        // The branch node at l+1 is usable
1496
27.8k
        path.offset(l + 1) =
1497
27.8k
          path.node<Branch>(l + 1).safeFind(path.offset(l + 1), x);
1498
27.8k
        return pathFillFind(x);
1499
27.8k
      }
1500
14.1k
      path.pop();
1501
14.1k
    }
1502
857k
    // Is the level-1 Branch usable?
1503
857k
    
if (829k
!Traits::stopLess(map->rootBranch().stop(path.offset(0)), x)829k
) {
1504
621k
      path.offset(1) = path.node<Branch>(1).safeFind(path.offset(1), x);
1505
621k
      return pathFillFind(x);
1506
621k
    }
1507
2.97M
  }
1508
2.97M
1509
2.97M
  // We reached the root.
1510
2.97M
  setRoot(map->rootBranch().findFrom(path.offset(0), map->rootSize, x));
1511
2.97M
  if (valid())
1512
2.33M
    pathFillFind(x);
1513
2.97M
}
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::treeAdvanceTo(llvm::SlotIndex)
Line
Count
Source
1481
14.9M
const_iterator::treeAdvanceTo(KeyT x) {
1482
14.9M
  // Can we stay on the same leaf node?
1483
14.9M
  if (!Traits::stopLess(path.leaf<Leaf>().stop(path.leafSize() - 1), x)) {
1484
11.2M
    path.leafOffset() = path.leaf<Leaf>().safeFind(path.leafOffset(), x);
1485
11.2M
    return;
1486
11.2M
  }
1487
3.61M
1488
3.61M
  // Drop the current leaf.
1489
3.61M
  path.pop();
1490
3.61M
1491
3.61M
  // Search towards the root for a usable subtree.
1492
3.61M
  if (path.height()) {
1493
871k
    for (unsigned l = path.height() - 1; l; 
--l14.1k
) {
1494
41.9k
      if (!Traits::stopLess(path.node<Branch>(l).stop(path.offset(l)), x)) {
1495
27.8k
        // The branch node at l+1 is usable
1496
27.8k
        path.offset(l + 1) =
1497
27.8k
          path.node<Branch>(l + 1).safeFind(path.offset(l + 1), x);
1498
27.8k
        return pathFillFind(x);
1499
27.8k
      }
1500
14.1k
      path.pop();
1501
14.1k
    }
1502
857k
    // Is the level-1 Branch usable?
1503
857k
    
if (829k
!Traits::stopLess(map->rootBranch().stop(path.offset(0)), x)829k
) {
1504
620k
      path.offset(1) = path.node<Branch>(1).safeFind(path.offset(1), x);
1505
620k
      return pathFillFind(x);
1506
620k
    }
1507
2.97M
  }
1508
2.97M
1509
2.97M
  // We reached the root.
1510
2.97M
  setRoot(map->rootBranch().findFrom(path.offset(0), map->rootSize, x));
1511
2.97M
  if (valid())
1512
2.32M
    pathFillFind(x);
1513
2.97M
}
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::treeAdvanceTo(llvm::SlotIndex)
Line
Count
Source
1481
8
const_iterator::treeAdvanceTo(KeyT x) {
1482
8
  // Can we stay on the same leaf node?
1483
8
  if (!Traits::stopLess(path.leaf<Leaf>().stop(path.leafSize() - 1), x)) {
1484
4
    path.leafOffset() = path.leaf<Leaf>().safeFind(path.leafOffset(), x);
1485
4
    return;
1486
4
  }
1487
4
1488
4
  // Drop the current leaf.
1489
4
  path.pop();
1490
4
1491
4
  // Search towards the root for a usable subtree.
1492
4
  if (path.height()) {
1493
0
    for (unsigned l = path.height() - 1; l; --l) {
1494
0
      if (!Traits::stopLess(path.node<Branch>(l).stop(path.offset(l)), x)) {
1495
0
        // The branch node at l+1 is usable
1496
0
        path.offset(l + 1) =
1497
0
          path.node<Branch>(l + 1).safeFind(path.offset(l + 1), x);
1498
0
        return pathFillFind(x);
1499
0
      }
1500
0
      path.pop();
1501
0
    }
1502
0
    // Is the level-1 Branch usable?
1503
0
    if (!Traits::stopLess(map->rootBranch().stop(path.offset(0)), x)) {
1504
0
      path.offset(1) = path.node<Branch>(1).safeFind(path.offset(1), x);
1505
0
      return pathFillFind(x);
1506
0
    }
1507
4
  }
1508
4
1509
4
  // We reached the root.
1510
4
  setRoot(map->rootBranch().findFrom(path.offset(0), map->rootSize, x));
1511
4
  if (valid())
1512
0
    pathFillFind(x);
1513
4
}
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::const_iterator::treeAdvanceTo(llvm::SlotIndex)
Line
Count
Source
1481
138k
const_iterator::treeAdvanceTo(KeyT x) {
1482
138k
  // Can we stay on the same leaf node?
1483
138k
  if (!Traits::stopLess(path.leaf<Leaf>().stop(path.leafSize() - 1), x)) {
1484
129k
    path.leafOffset() = path.leaf<Leaf>().safeFind(path.leafOffset(), x);
1485
129k
    return;
1486
129k
  }
1487
8.66k
1488
8.66k
  // Drop the current leaf.
1489
8.66k
  path.pop();
1490
8.66k
1491
8.66k
  // Search towards the root for a usable subtree.
1492
8.66k
  if (path.height()) {
1493
406
    for (unsigned l = path.height() - 1; l; 
--l0
) {
1494
0
      if (!Traits::stopLess(path.node<Branch>(l).stop(path.offset(l)), x)) {
1495
0
        // The branch node at l+1 is usable
1496
0
        path.offset(l + 1) =
1497
0
          path.node<Branch>(l + 1).safeFind(path.offset(l + 1), x);
1498
0
        return pathFillFind(x);
1499
0
      }
1500
0
      path.pop();
1501
0
    }
1502
406
    // Is the level-1 Branch usable?
1503
406
    if (!Traits::stopLess(map->rootBranch().stop(path.offset(0)), x)) {
1504
369
      path.offset(1) = path.node<Branch>(1).safeFind(path.offset(1), x);
1505
369
      return pathFillFind(x);
1506
369
    }
1507
8.29k
  }
1508
8.29k
1509
8.29k
  // We reached the root.
1510
8.29k
  setRoot(map->rootBranch().findFrom(path.offset(0), map->rootSize, x));
1511
8.29k
  if (valid())
1512
6.63k
    pathFillFind(x);
1513
8.29k
}
1514
1515
//===----------------------------------------------------------------------===//
1516
//---                       IntervalMap::iterator                         ----//
1517
//===----------------------------------------------------------------------===//
1518
1519
template <typename KeyT, typename ValT, unsigned N, typename Traits>
1520
class IntervalMap<KeyT, ValT, N, Traits>::iterator : public const_iterator {
1521
  friend class IntervalMap;
1522
1523
  using IdxPair = IntervalMapImpl::IdxPair;
1524
1525
13.4M
  explicit iterator(IntervalMap &map) : const_iterator(map) {}
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::iterator::iterator(llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >&)
Line
Count
Source
1525
28.0k
  explicit iterator(IntervalMap &map) : const_iterator(map) {}
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::iterator::iterator(llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >&)
Line
Count
Source
1525
11.6M
  explicit iterator(IntervalMap &map) : const_iterator(map) {}
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::iterator::iterator(llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >&)
Line
Count
Source
1525
1.02M
  explicit iterator(IntervalMap &map) : const_iterator(map) {}
DAGCombiner.cpp:llvm::IntervalMap<long long, (anonymous namespace)::UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::iterator::iterator(llvm::IntervalMap<long long, (anonymous namespace)::UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >&)
Line
Count
Source
1525
744k
  explicit iterator(IntervalMap &map) : const_iterator(map) {}
1526
1527
  void setNodeStop(unsigned Level, KeyT Stop);
1528
  bool insertNode(unsigned Level, IntervalMapImpl::NodeRef Node, KeyT Stop);
1529
  template <typename NodeT> bool overflow(unsigned Level);
1530
  void treeInsert(KeyT a, KeyT b, ValT y);
1531
  void eraseNode(unsigned Level);
1532
  void treeErase(bool UpdateRoot = true);
1533
  bool canCoalesceLeft(KeyT Start, ValT x);
1534
  bool canCoalesceRight(KeyT Stop, ValT x);
1535
1536
public:
1537
  /// iterator - Create null iterator.
1538
3.58M
  iterator() = default;
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::iterator::iterator()
Line
Count
Source
1538
3.41M
  iterator() = default;
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::iterator::iterator()
Line
Count
Source
1538
15
  iterator() = default;
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::iterator::iterator()
Line
Count
Source
1538
164k
  iterator() = default;
1539
1540
  /// setStart - Move the start of the current interval.
1541
  /// This may cause coalescing with the previous interval.
1542
  /// @param a New start key, must not overlap the previous interval.
1543
  void setStart(KeyT a);
1544
1545
  /// setStop - Move the end of the current interval.
1546
  /// This may cause coalescing with the following interval.
1547
  /// @param b New stop key, must not overlap the following interval.
1548
  void setStop(KeyT b);
1549
1550
  /// setValue - Change the mapped value of the current interval.
1551
  /// This may cause coalescing with the previous and following intervals.
1552
  /// @param x New value.
1553
  void setValue(ValT x);
1554
1555
  /// setStartUnchecked - Move the start of the current interval without
1556
  /// checking for coalescing or overlaps.
1557
  /// This should only be used when it is known that coalescing is not required.
1558
  /// @param a New start key.
1559
4.27k
  void setStartUnchecked(KeyT a) { this->unsafeStart() = a; }
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::iterator::setStartUnchecked(llvm::SlotIndex)
Line
Count
Source
1559
4.27k
  void setStartUnchecked(KeyT a) { this->unsafeStart() = a; }
Unexecuted instantiation: llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::iterator::setStartUnchecked(llvm::SlotIndex)
1560
1561
  /// setStopUnchecked - Move the end of the current interval without checking
1562
  /// for coalescing or overlaps.
1563
  /// This should only be used when it is known that coalescing is not required.
1564
  /// @param b New stop key.
1565
211
  void setStopUnchecked(KeyT b) {
1566
211
    this->unsafeStop() = b;
1567
211
    // Update keys in branch nodes as well.
1568
211
    if (this->path.atLastEntry(this->path.height()))
1569
82
      setNodeStop(this->path.height(), b);
1570
211
  }
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::iterator::setStopUnchecked(llvm::SlotIndex)
Line
Count
Source
1565
48
  void setStopUnchecked(KeyT b) {
1566
48
    this->unsafeStop() = b;
1567
48
    // Update keys in branch nodes as well.
1568
48
    if (this->path.atLastEntry(this->path.height()))
1569
47
      setNodeStop(this->path.height(), b);
1570
48
  }
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::iterator::setStopUnchecked(llvm::SlotIndex)
Line
Count
Source
1565
163
  void setStopUnchecked(KeyT b) {
1566
163
    this->unsafeStop() = b;
1567
163
    // Update keys in branch nodes as well.
1568
163
    if (this->path.atLastEntry(this->path.height()))
1569
35
      setNodeStop(this->path.height(), b);
1570
163
  }
1571
1572
  /// setValueUnchecked - Change the mapped value of the current interval
1573
  /// without checking for coalescing.
1574
  /// @param x New value.
1575
4.92k
  void setValueUnchecked(ValT x) { this->unsafeValue() = x; }
1576
1577
  /// insert - Insert mapping [a;b] -> y before the current position.
1578
  void insert(KeyT a, KeyT b, ValT y);
1579
1580
  /// erase - Erase the current interval.
1581
  void erase();
1582
1583
28.7M
  iterator &operator++() {
1584
28.7M
    const_iterator::operator++();
1585
28.7M
    return *this;
1586
28.7M
  }
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::iterator::operator++()
Line
Count
Source
1583
28.7M
  iterator &operator++() {
1584
28.7M
    const_iterator::operator++();
1585
28.7M
    return *this;
1586
28.7M
  }
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::iterator::operator++()
Line
Count
Source
1583
9.59k
  iterator &operator++() {
1584
9.59k
    const_iterator::operator++();
1585
9.59k
    return *this;
1586
9.59k
  }
1587
1588
  iterator operator++(int) {
1589
    iterator tmp = *this;
1590
    operator++();
1591
    return tmp;
1592
  }
1593
1594
5.72M
  iterator &operator--() {
1595
5.72M
    const_iterator::operator--();
1596
5.72M
    return *this;
1597
5.72M
  }
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::iterator::operator--()
Line
Count
Source
1594
5.69M
  iterator &operator--() {
1595
5.69M
    const_iterator::operator--();
1596
5.69M
    return *this;
1597
5.69M
  }
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::iterator::operator--()
Line
Count
Source
1594
12
  iterator &operator--() {
1595
12
    const_iterator::operator--();
1596
12
    return *this;
1597
12
  }
DAGCombiner.cpp:llvm::IntervalMap<long long, (anonymous namespace)::UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::iterator::operator--()
Line
Count
Source
1594
23.1k
  iterator &operator--() {
1595
23.1k
    const_iterator::operator--();
1596
23.1k
    return *this;
1597
23.1k
  }
1598
1599
  iterator operator--(int) {
1600
    iterator tmp = *this;
1601
    operator--();
1602
    return tmp;
1603
  }
1604
};
1605
1606
/// canCoalesceLeft - Can the current interval coalesce to the left after
1607
/// changing start or value?
1608
/// @param Start New start of current interval.
1609
/// @param Value New value for current interval.
1610
/// @return True when updating the current interval would enable coalescing.
1611
template <typename KeyT, typename ValT, unsigned N, typename Traits>
1612
bool IntervalMap<KeyT, ValT, N, Traits>::
1613
53
iterator::canCoalesceLeft(KeyT Start, ValT Value) {
1614
53
  using namespace IntervalMapImpl;
1615
53
  Path &P = this->path;
1616
53
  if (!this->branched()) {
1617
53
    unsigned i = P.leafOffset();
1618
53
    RootLeaf &Node = P.leaf<RootLeaf>();
1619
53
    return i && 
Node.value(i-1) == Value21
&&
1620
53
                
Traits::adjacent(Node.stop(i-1), Start)3
;
1621
53
  }
1622
0
  // Branched.
1623
0
  if (unsigned i = P.leafOffset()) {
1624
0
    Leaf &Node = P.leaf<Leaf>();
1625
0
    return Node.value(i-1) == Value && Traits::adjacent(Node.stop(i-1), Start);
1626
0
  } else if (NodeRef NR = P.getLeftSibling(P.height())) {
1627
0
    unsigned i = NR.size() - 1;
1628
0
    Leaf &Node = NR.get<Leaf>();
1629
0
    return Node.value(i) == Value && Traits::adjacent(Node.stop(i), Start);
1630
0
  }
1631
0
  return false;
1632
0
}
1633
1634
/// canCoalesceRight - Can the current interval coalesce to the right after
1635
/// changing stop or value?
1636
/// @param Stop New stop of current interval.
1637
/// @param Value New value for current interval.
1638
/// @return True when updating the current interval would enable coalescing.
1639
template <typename KeyT, typename ValT, unsigned N, typename Traits>
1640
bool IntervalMap<KeyT, ValT, N, Traits>::
1641
53
iterator::canCoalesceRight(KeyT Stop, ValT Value) {
1642
53
  using namespace IntervalMapImpl;
1643
53
  Path &P = this->path;
1644
53
  unsigned i = P.leafOffset() + 1;
1645
53
  if (!this->branched()) {
1646
53
    if (i >= P.leafSize())
1647
41
      return false;
1648
12
    RootLeaf &Node = P.leaf<RootLeaf>();
1649
12
    return Node.value(i) == Value && 
Traits::adjacent(Stop, Node.start(i))0
;
1650
12
  }
1651
0
  // Branched.
1652
0
  if (i < P.leafSize()) {
1653
0
    Leaf &Node = P.leaf<Leaf>();
1654
0
    return Node.value(i) == Value && Traits::adjacent(Stop, Node.start(i));
1655
0
  } else if (NodeRef NR = P.getRightSibling(P.height())) {
1656
0
    Leaf &Node = NR.get<Leaf>();
1657
0
    return Node.value(0) == Value && Traits::adjacent(Stop, Node.start(0));
1658
0
  }
1659
0
  return false;
1660
0
}
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::iterator::canCoalesceRight(llvm::SlotIndex, DbgValueLocation)
Line
Count
Source
1641
53
iterator::canCoalesceRight(KeyT Stop, ValT Value) {
1642
53
  using namespace IntervalMapImpl;
1643
53
  Path &P = this->path;
1644
53
  unsigned i = P.leafOffset() + 1;
1645
53
  if (!this->branched()) {
1646
53
    if (i >= P.leafSize())
1647
41
      return false;
1648
12
    RootLeaf &Node = P.leaf<RootLeaf>();
1649
12
    return Node.value(i) == Value && 
Traits::adjacent(Stop, Node.start(i))0
;
1650
12
  }
1651
0
  // Branched.
1652
0
  if (i < P.leafSize()) {
1653
0
    Leaf &Node = P.leaf<Leaf>();
1654
0
    return Node.value(i) == Value && Traits::adjacent(Stop, Node.start(i));
1655
0
  } else if (NodeRef NR = P.getRightSibling(P.height())) {
1656
0
    Leaf &Node = NR.get<Leaf>();
1657
0
    return Node.value(0) == Value && Traits::adjacent(Stop, Node.start(0));
1658
0
  }
1659
0
  return false;
1660
0
}
Unexecuted instantiation: llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::iterator::canCoalesceRight(llvm::SlotIndex, unsigned int)
1661
1662
/// setNodeStop - Update the stop key of the current node at level and above.
1663
template <typename KeyT, typename ValT, unsigned N, typename Traits>
1664
void IntervalMap<KeyT, ValT, N, Traits>::
1665
4.32M
iterator::setNodeStop(unsigned Level, KeyT Stop) {
1666
4.32M
  // There are no references to the root node, so nothing to update.
1667
4.32M
  if (!Level)
1668
47
    return;
1669
4.32M
  IntervalMapImpl::Path &P = this->path;
1670
4.32M
  // Update nodes pointing to the current node.
1671
4.72M
  while (--Level) {
1672
1.06M
    P.node<Branch>(Level).stop(P.offset(Level)) = Stop;
1673
1.06M
    if (!P.atLastEntry(Level))
1674
653k
      return;
1675
1.06M
  }
1676
4.32M
  // Update root separately since it has a different layout.
1677
4.32M
  P.node<RootBranch>(Level).stop(P.offset(Level)) = Stop;
1678
3.66M
}
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::iterator::setNodeStop(unsigned int, llvm::SlotIndex)
Line
Count
Source
1665
63
iterator::setNodeStop(unsigned Level, KeyT Stop) {
1666
63
  // There are no references to the root node, so nothing to update.
1667
63
  if (!Level)
1668
47
    return;
1669
16
  IntervalMapImpl::Path &P = this->path;
1670
16
  // Update nodes pointing to the current node.
1671
16
  while (--Level) {
1672
0
    P.node<Branch>(Level).stop(P.offset(Level)) = Stop;
1673
0
    if (!P.atLastEntry(Level))
1674
0
      return;
1675
0
  }
1676
16
  // Update root separately since it has a different layout.
1677
16
  P.node<RootBranch>(Level).stop(P.offset(Level)) = Stop;
1678
16
}
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::iterator::setNodeStop(unsigned int, llvm::SlotIndex)
Line
Count
Source
1665
4.13M
iterator::setNodeStop(unsigned Level, KeyT Stop) {
1666
4.13M
  // There are no references to the root node, so nothing to update.
1667
4.13M
  if (!Level)
1668
0
    return;
1669
4.13M
  IntervalMapImpl::Path &P = this->path;
1670
4.13M
  // Update nodes pointing to the current node.
1671
4.53M
  while (--Level) {
1672
1.04M
    P.node<Branch>(Level).stop(P.offset(Level)) = Stop;
1673
1.04M
    if (!P.atLastEntry(Level))
1674
645k
      return;
1675
1.04M
  }
1676
4.13M
  // Update root separately since it has a different layout.
1677
4.13M
  P.node<RootBranch>(Level).stop(P.offset(Level)) = Stop;
1678
3.48M
}
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::iterator::setNodeStop(unsigned int, llvm::SlotIndex)
Line
Count
Source
1665
187k
iterator::setNodeStop(unsigned Level, KeyT Stop) {
1666
187k
  // There are no references to the root node, so nothing to update.
1667
187k
  if (!Level)
1668
0
    return;
1669
187k
  IntervalMapImpl::Path &P = this->path;
1670
187k
  // Update nodes pointing to the current node.
1671
191k
  while (--Level) {
1672
12.0k
    P.node<Branch>(Level).stop(P.offset(Level)) = Stop;
1673
12.0k
    if (!P.atLastEntry(Level))
1674
7.97k
      return;
1675
12.0k
  }
1676
187k
  // Update root separately since it has a different layout.
1677
187k
  P.node<RootBranch>(Level).stop(P.offset(Level)) = Stop;
1678
179k
}
DAGCombiner.cpp:llvm::IntervalMap<long long, (anonymous namespace)::UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::iterator::setNodeStop(unsigned int, long long)
Line
Count
Source
1665
352
iterator::setNodeStop(unsigned Level, KeyT Stop) {
1666
352
  // There are no references to the root node, so nothing to update.
1667
352
  if (!Level)
1668
0
    return;
1669
352
  IntervalMapImpl::Path &P = this->path;
1670
352
  // Update nodes pointing to the current node.
1671
352
  while (--Level) {
1672
0
    P.node<Branch>(Level).stop(P.offset(Level)) = Stop;
1673
0
    if (!P.atLastEntry(Level))
1674
0
      return;
1675
0
  }
1676
352
  // Update root separately since it has a different layout.
1677
352
  P.node<RootBranch>(Level).stop(P.offset(Level)) = Stop;
1678
352
}
1679
1680
template <typename KeyT, typename ValT, unsigned N, typename Traits>
1681
void IntervalMap<KeyT, ValT, N, Traits>::
1682
4.84k
iterator::setStart(KeyT a) {
1683
4.84k
  assert(Traits::nonEmpty(a, this->stop()) && "Cannot move start beyond stop");
1684
4.84k
  KeyT &CurStart = this->unsafeStart();
1685
4.84k
  if (!Traits::startLess(a, CurStart) || 
!canCoalesceLeft(a, this->value())0
) {
1686
4.84k
    CurStart = a;
1687
4.84k
    return;
1688
4.84k
  }
1689
0
  // Coalesce with the interval to the left.
1690
0
  --*this;
1691
0
  a = this->start();
1692
0
  erase();
1693
0
  setStartUnchecked(a);
1694
0
}
1695
1696
template <typename KeyT, typename ValT, unsigned N, typename Traits>
1697
void IntervalMap<KeyT, ValT, N, Traits>::
1698
163
iterator::setStop(KeyT b) {
1699
163
  assert(Traits::nonEmpty(this->start(), b) && "Cannot move stop beyond start");
1700
163
  if (Traits::startLess(b, this->stop()) ||
1701
163
      
!canCoalesceRight(b, this->value())0
) {
1702
163
    setStopUnchecked(b);
1703
163
    return;
1704
163
  }
1705
0
  // Coalesce with interval to the right.
1706
0
  KeyT a = this->start();
1707
0
  erase();
1708
0
  setStartUnchecked(a);
1709
0
}
1710
1711
template <typename KeyT, typename ValT, unsigned N, typename Traits>
1712
void IntervalMap<KeyT, ValT, N, Traits>::
1713
53
iterator::setValue(ValT x) {
1714
53
  setValueUnchecked(x);
1715
53
  if (canCoalesceRight(this->stop(), x)) {
1716
0
    KeyT a = this->start();
1717
0
    erase();
1718
0
    setStartUnchecked(a);
1719
0
  }
1720
53
  if (canCoalesceLeft(this->start(), x)) {
1721
3
    --*this;
1722
3
    KeyT a = this->start();
1723
3
    erase();
1724
3
    setStartUnchecked(a);
1725
3
  }
1726
53
}
1727
1728
/// insertNode - insert a node before the current path at level.
1729
/// Leave the current path pointing at the new node.
1730
/// @param Level path index of the node to be inserted.
1731
/// @param Node The node to be inserted.
1732
/// @param Stop The last index in the new node.
1733
/// @return True if the tree height was increased.
1734
template <typename KeyT, typename ValT, unsigned N, typename Traits>
1735
bool IntervalMap<KeyT, ValT, N, Traits>::
1736
445k
iterator::insertNode(unsigned Level, IntervalMapImpl::NodeRef Node, KeyT Stop) {
1737
445k
  assert(Level && "Cannot insert next to the root");
1738
445k
  bool SplitRoot = false;
1739
445k
  IntervalMap &IM = *this->map;
1740
445k
  IntervalMapImpl::Path &P = this->path;
1741
445k
1742
445k
  if (Level == 1) {
1743
346k
    // Insert into the root branch node.
1744
346k
    if (IM.rootSize < RootBranch::Capacity) {
1745
339k
      IM.rootBranch().insert(P.offset(0), IM.rootSize, Node, Stop);
1746
339k
      P.setSize(0, ++IM.rootSize);
1747
339k
      P.reset(Level);
1748
339k
      return SplitRoot;
1749
339k
    }
1750
7.47k
1751
7.47k
    // We need to split the root while keeping our position.
1752
7.47k
    SplitRoot = true;
1753
7.47k
    IdxPair Offset = IM.splitRoot(P.offset(0));
1754
7.47k
    P.replaceRoot(&IM.rootBranch(), IM.rootSize, Offset);
1755
7.47k
1756
7.47k
    // Fall through to insert at the new higher level.
1757
7.47k
    ++Level;
1758
7.47k
  }
1759
445k
1760
445k
  // When inserting before end(), make sure we have a valid path.
1761
445k
  P.legalizeForInsert(--Level);
1762
106k
1763
106k
  // Insert into the branch node at Level-1.
1764
106k
  if (P.size(Level) == Branch::Capacity) {
1765
28.9k
    // Branch node is full, handle handle the overflow.
1766
28.9k
    assert(!SplitRoot && "Cannot overflow after splitting the root");
1767
28.9k
    SplitRoot = overflow<Branch>(Level);
1768
28.9k
    Level += SplitRoot;
1769
28.9k
  }
1770
106k
  P.node<Branch>(Level).insert(P.offset(Level), P.size(Level), Node, Stop);
1771
106k
  P.setSize(Level, P.size(Level) + 1);
1772
106k
  if (P.atLastEntry(Level))
1773
1.02k
    setNodeStop(Level, Stop);
1774
106k
  P.reset(Level + 1);
1775
106k
  return SplitRoot;
1776
445k
}
Unexecuted instantiation: llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::iterator::insertNode(unsigned int, llvm::IntervalMapImpl::NodeRef, llvm::SlotIndex)
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::iterator::insertNode(unsigned int, llvm::IntervalMapImpl::NodeRef, llvm::SlotIndex)
Line
Count
Source
1736
436k
iterator::insertNode(unsigned Level, IntervalMapImpl::NodeRef Node, KeyT Stop) {
1737
436k
  assert(Level && "Cannot insert next to the root");
1738
436k
  bool SplitRoot = false;
1739
436k
  IntervalMap &IM = *this->map;
1740
436k
  IntervalMapImpl::Path &P = this->path;
1741
436k
1742
436k
  if (Level == 1) {
1743
337k
    // Insert into the root branch node.
1744
337k
    if (IM.rootSize < RootBranch::Capacity) {
1745
330k
      IM.rootBranch().insert(P.offset(0), IM.rootSize, Node, Stop);
1746
330k
      P.setSize(0, ++IM.rootSize);
1747
330k
      P.reset(Level);
1748
330k
      return SplitRoot;
1749
330k
    }
1750
7.39k
1751
7.39k
    // We need to split the root while keeping our position.
1752
7.39k
    SplitRoot = true;
1753
7.39k
    IdxPair Offset = IM.splitRoot(P.offset(0));
1754
7.39k
    P.replaceRoot(&IM.rootBranch(), IM.rootSize, Offset);
1755
7.39k
1756
7.39k
    // Fall through to insert at the new higher level.
1757
7.39k
    ++Level;
1758
7.39k
  }
1759
436k
1760
436k
  // When inserting before end(), make sure we have a valid path.
1761
436k
  P.legalizeForInsert(--Level);
1762
105k
1763
105k
  // Insert into the branch node at Level-1.
1764
105k
  if (P.size(Level) == Branch::Capacity) {
1765
28.7k
    // Branch node is full, handle handle the overflow.
1766
28.7k
    assert(!SplitRoot && "Cannot overflow after splitting the root");
1767
28.7k
    SplitRoot = overflow<Branch>(Level);
1768
28.7k
    Level += SplitRoot;
1769
28.7k
  }
1770
105k
  P.node<Branch>(Level).insert(P.offset(Level), P.size(Level), Node, Stop);
1771
105k
  P.setSize(Level, P.size(Level) + 1);
1772
105k
  if (P.atLastEntry(Level))
1773
1.02k
    setNodeStop(Level, Stop);
1774
105k
  P.reset(Level + 1);
1775
105k
  return SplitRoot;
1776
436k
}
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::iterator::insertNode(unsigned int, llvm::IntervalMapImpl::NodeRef, llvm::SlotIndex)
Line
Count
Source
1736
9.52k
iterator::insertNode(unsigned Level, IntervalMapImpl::NodeRef Node, KeyT Stop) {
1737
9.52k
  assert(Level && "Cannot insert next to the root");
1738
9.52k
  bool SplitRoot = false;
1739
9.52k
  IntervalMap &IM = *this->map;
1740
9.52k
  IntervalMapImpl::Path &P = this->path;
1741
9.52k
1742
9.52k
  if (Level == 1) {
1743
8.58k
    // Insert into the root branch node.
1744
8.58k
    if (IM.rootSize < RootBranch::Capacity) {
1745
8.50k
      IM.rootBranch().insert(P.offset(0), IM.rootSize, Node, Stop);
1746
8.50k
      P.setSize(0, ++IM.rootSize);
1747
8.50k
      P.reset(Level);
1748
8.50k
      return SplitRoot;
1749
8.50k
    }
1750
81
1751
81
    // We need to split the root while keeping our position.
1752
81
    SplitRoot = true;
1753
81
    IdxPair Offset = IM.splitRoot(P.offset(0));
1754
81
    P.replaceRoot(&IM.rootBranch(), IM.rootSize, Offset);
1755
81
1756
81
    // Fall through to insert at the new higher level.
1757
81
    ++Level;
1758
81
  }
1759
9.52k
1760
9.52k
  // When inserting before end(), make sure we have a valid path.
1761
9.52k
  P.legalizeForInsert(--Level);
1762
1.02k
1763
1.02k
  // Insert into the branch node at Level-1.
1764
1.02k
  if (P.size(Level) == Branch::Capacity) {
1765
277
    // Branch node is full, handle handle the overflow.
1766
277
    assert(!SplitRoot && "Cannot overflow after splitting the root");
1767
277
    SplitRoot = overflow<Branch>(Level);
1768
277
    Level += SplitRoot;
1769
277
  }
1770
1.02k
  P.node<Branch>(Level).insert(P.offset(Level), P.size(Level), Node, Stop);
1771
1.02k
  P.setSize(Level, P.size(Level) + 1);
1772
1.02k
  if (P.atLastEntry(Level))
1773
7
    setNodeStop(Level, Stop);
1774
1.02k
  P.reset(Level + 1);
1775
1.02k
  return SplitRoot;
1776
9.52k
}
DAGCombiner.cpp:llvm::IntervalMap<long long, (anonymous namespace)::UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::iterator::insertNode(unsigned int, llvm::IntervalMapImpl::NodeRef, long long)
Line
Count
Source
1736
84
iterator::insertNode(unsigned Level, IntervalMapImpl::NodeRef Node, KeyT Stop) {
1737
84
  assert(Level && "Cannot insert next to the root");
1738
84
  bool SplitRoot = false;
1739
84
  IntervalMap &IM = *this->map;
1740
84
  IntervalMapImpl::Path &P = this->path;
1741
84
1742
84
  if (Level == 1) {
1743
84
    // Insert into the root branch node.
1744
84
    if (IM.rootSize < RootBranch::Capacity) {
1745
84
      IM.rootBranch().insert(P.offset(0), IM.rootSize, Node, Stop);
1746
84
      P.setSize(0, ++IM.rootSize);
1747
84
      P.reset(Level);
1748
84
      return SplitRoot;
1749
84
    }
1750
0
1751
0
    // We need to split the root while keeping our position.
1752
0
    SplitRoot = true;
1753
0
    IdxPair Offset = IM.splitRoot(P.offset(0));
1754
0
    P.replaceRoot(&IM.rootBranch(), IM.rootSize, Offset);
1755
0
1756
0
    // Fall through to insert at the new higher level.
1757
0
    ++Level;
1758
0
  }
1759
84
1760
84
  // When inserting before end(), make sure we have a valid path.
1761
84
  P.legalizeForInsert(--Level);
1762
0
1763
0
  // Insert into the branch node at Level-1.
1764
0
  if (P.size(Level) == Branch::Capacity) {
1765
0
    // Branch node is full, handle handle the overflow.
1766
0
    assert(!SplitRoot && "Cannot overflow after splitting the root");
1767
0
    SplitRoot = overflow<Branch>(Level);
1768
0
    Level += SplitRoot;
1769
0
  }
1770
0
  P.node<Branch>(Level).insert(P.offset(Level), P.size(Level), Node, Stop);
1771
0
  P.setSize(Level, P.size(Level) + 1);
1772
0
  if (P.atLastEntry(Level))
1773
0
    setNodeStop(Level, Stop);
1774
0
  P.reset(Level + 1);
1775
0
  return SplitRoot;
1776
84
}
1777
1778
// insert
1779
template <typename KeyT, typename ValT, unsigned N, typename Traits>
1780
void IntervalMap<KeyT, ValT, N, Traits>::
1781
17.1M
iterator::insert(KeyT a, KeyT b, ValT y) {
1782
17.1M
  if (this->branched())
1783
5.34M
    return treeInsert(a, b, y);
1784
11.8M
  IntervalMap &IM = *this->map;
1785
11.8M
  IntervalMapImpl::Path &P = this->path;
1786
11.8M
1787
11.8M
  // Try simple root leaf insert.
1788
11.8M
  unsigned Size = IM.rootLeaf().insertFrom(P.leafOffset(), IM.rootSize, a, b, y);
1789
11.8M
1790
11.8M
  // Was the root node insert successful?
1791
11.8M
  if (Size <= RootLeaf::Capacity) {
1792
11.5M
    P.setSize(0, IM.rootSize = Size);
1793
11.5M
    return;
1794
11.5M
  }
1795
326k
1796
326k
  // Root leaf node is full, we must branch.
1797
326k
  IdxPair Offset = IM.branchRoot(P.leafOffset());
1798
326k
  P.replaceRoot(&IM.rootBranch(), IM.rootSize, Offset);
1799
326k
1800
326k
  // Now it fits in the new leaf.
1801
326k
  treeInsert(a, b, y);
1802
326k
}
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::iterator::insert(llvm::SlotIndex, llvm::SlotIndex, DbgValueLocation)
Line
Count
Source
1781
9.51k
iterator::insert(KeyT a, KeyT b, ValT y) {
1782
9.51k
  if (this->branched())
1783
42
    return treeInsert(a, b, y);
1784
9.47k
  IntervalMap &IM = *this->map;
1785
9.47k
  IntervalMapImpl::Path &P = this->path;
1786
9.47k
1787
9.47k
  // Try simple root leaf insert.
1788
9.47k
  unsigned Size = IM.rootLeaf().insertFrom(P.leafOffset(), IM.rootSize, a, b, y);
1789
9.47k
1790
9.47k
  // Was the root node insert successful?
1791
9.47k
  if (Size <= RootLeaf::Capacity) {
1792
9.47k
    P.setSize(0, IM.rootSize = Size);
1793
9.47k
    return;
1794
9.47k
  }
1795
5
1796
5
  // Root leaf node is full, we must branch.
1797
5
  IdxPair Offset = IM.branchRoot(P.leafOffset());
1798
5
  P.replaceRoot(&IM.rootBranch(), IM.rootSize, Offset);
1799
5
1800
5
  // Now it fits in the new leaf.
1801
5
  treeInsert(a, b, y);
1802
5
}
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::iterator::insert(llvm::SlotIndex, llvm::SlotIndex, llvm::LiveInterval*)
Line
Count
Source
1781
16.3M
iterator::insert(KeyT a, KeyT b, ValT y) {
1782
16.3M
  if (this->branched())
1783
4.58M
    return treeInsert(a, b, y);
1784
11.7M
  IntervalMap &IM = *this->map;
1785
11.7M
  IntervalMapImpl::Path &P = this->path;
1786
11.7M
1787
11.7M
  // Try simple root leaf insert.
1788
11.7M
  unsigned Size = IM.rootLeaf().insertFrom(P.leafOffset(), IM.rootSize, a, b, y);
1789
11.7M
1790
11.7M
  // Was the root node insert successful?
1791
11.7M
  if (Size <= RootLeaf::Capacity) {
1792
11.4M
    P.setSize(0, IM.rootSize = Size);
1793
11.4M
    return;
1794
11.4M
  }
1795
309k
1796
309k
  // Root leaf node is full, we must branch.
1797
309k
  IdxPair Offset = IM.branchRoot(P.leafOffset());
1798
309k
  P.replaceRoot(&IM.rootBranch(), IM.rootSize, Offset);
1799
309k
1800
309k
  // Now it fits in the new leaf.
1801
309k
  treeInsert(a, b, y);
1802
309k
}
llvm::IntervalMap<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::iterator::insert(llvm::SlotIndex, llvm::SlotIndex, unsigned int)
Line
Count
Source
1781
824k
iterator::insert(KeyT a, KeyT b, ValT y) {
1782
824k
  if (this->branched())
1783
760k
    return treeInsert(a, b, y);
1784
63.3k
  IntervalMap &IM = *this->map;
1785
63.3k
  IntervalMapImpl::Path &P = this->path;
1786
63.3k
1787
63.3k
  // Try simple root leaf insert.
1788
63.3k
  unsigned Size = IM.rootLeaf().insertFrom(P.leafOffset(), IM.rootSize, a, b, y);
1789
63.3k
1790
63.3k
  // Was the root node insert successful?
1791
63.3k
  if (Size <= RootLeaf::Capacity) {
1792
46.9k
    P.setSize(0, IM.rootSize = Size);
1793
46.9k
    return;
1794
46.9k
  }
1795
16.4k
1796
16.4k
  // Root leaf node is full, we must branch.
1797
16.4k
  IdxPair Offset = IM.branchRoot(P.leafOffset());
1798
16.4k
  P.replaceRoot(&IM.rootBranch(), IM.rootSize, Offset);
1799
16.4k
1800
16.4k
  // Now it fits in the new leaf.
1801
16.4k
  treeInsert(a, b, y);
1802
16.4k
}
DAGCombiner.cpp:llvm::IntervalMap<long long, (anonymous namespace)::UnitT, 8u, llvm::IntervalMapHalfOpenInfo<long long> >::iterator::insert(long long, long long, (anonymous namespace)::UnitT)
Line
Count
Source
1781
1.33k
iterator::insert(KeyT a, KeyT b, ValT y) {
1782
1.33k
  if (this->branched())
1783
1.10k
    return treeInsert(a, b, y);
1784
229
  IntervalMap &IM = *this->map;
1785
229
  IntervalMapImpl::Path &P = this->path;
1786
229
1787
229
  // Try simple root leaf insert.
1788
229
  unsigned Size = IM.rootLeaf().insertFrom(P.leafOffset(), IM.rootSize, a, b, y);
1789
229
1790
229
  // Was the root node insert successful?
1791
229
  if (Size <= RootLeaf::Capacity) {
1792
137
    P.setSize(0, IM.rootSize = Size);
1793
137
    return;
1794
137
  }
1795
92
1796
92
  // Root leaf node is full, we must branch.
1797
92
  IdxPair Offset = IM.branchRoot(P.leafOffset());
1798
92
  P.replaceRoot(&IM.rootBranch(), IM.rootSize, Offset);
1799
92
1800
92
  // Now it fits in the new leaf.
1801
92
  treeInsert(a, b, y);
1802
92
}
1803
1804
template <typename KeyT, typename ValT, unsigned N, typename Traits>
1805
void IntervalMap<KeyT, ValT, N, Traits>::
1806
5.66M
iterator::treeInsert(KeyT a, KeyT b, ValT y) {
1807
5.66M
  using namespace IntervalMapImpl;
1808
5.66M
  Path &P = this->path;
1809
5.66M
1810
5.66M
  if (!P.valid())
1811
1.02M
    P.legalizeForInsert(this->map->height);
1812
5.66M
1813
5.66M
  // Check if this insertion will extend the node to the left.
1814
5.66M
  if (P.leafOffset() == 0 && 
Traits::startLess(a, P.leaf<Leaf>().start(0))409k
) {
1815
409k
    // Node is growing to the left, will it affect a left sibling node?
1816
409k
    if (NodeRef Sib = P.getLeftSibling(P.height())) {
1817
311k
      Leaf &SibLeaf = Sib.get<Leaf>();
1818
311k
      unsigned SibOfs = Sib.size() - 1;
1819
311k
      if (SibLeaf.value(SibOfs) == y &&
1820
311k
          
Traits::adjacent(SibLeaf.stop(SibOfs), a)110k
) {
1821
64.0k
        // This insertion will coalesce with the last entry in SibLeaf. We can
1822
64.0k
        // handle it in two ways:
1823
64.0k
        //  1. Extend SibLeaf.stop to b and be done, or
1824
64.0k
        //  2. Extend a to SibLeaf, erase the SibLeaf entry and continue.
1825
64.0k
        // We prefer 1., but need 2 when coalescing to the right as well.
1826
64.0k
        Leaf &CurLeaf = P.leaf<Leaf>();
1827
64.0k
        P.moveLeft(P.height());
1828
64.0k
        if (Traits::stopLess(b, CurLeaf.start(0)) &&
1829
64.0k
            (y != CurLeaf.value(0) || 
!Traits::adjacent(b, CurLeaf.start(0))46.8k
)) {
1830
41.3k
          // Easy, just extend SibLeaf and we're done.
1831
41.3k
          setNodeStop(P.height(), SibLeaf.stop(SibOfs) = b);
1832
41.3k
          return;
1833
41.3k
        } else {
1834
22.7k
          // We have both left and right coalescing. Erase the old SibLeaf entry
1835
22.7k
          // and continue inserting the larger interval.
1836
22.7k
          a = SibLeaf.start(SibOfs);
1837
22.7k
          treeErase(/* UpdateRoot= */false);
1838
22.7k
        }
1839
64.0k
      }
1840
311k
    } else {
1841
98.3k
      // No left sibling means we are at begin(). Update cached bound.
1842
98.3k
      this->map->rootBranchStart() = a;
1843
98.3k
    }
1844
409k
  }
1845
5.66M
1846
5.66M
  // When we are inserting at the end of a leaf node, we must update stops.
1847
5.66M
  unsigned Size = P.leafSize();
1848
5.62M
  bool Grow = P.leafOffset() == Size;
1849
5.62M
  Size = P.leaf<Leaf>().insertFrom(P.leafOffset(), Size, a, b, y);
1850
5.62M
1851
5.62M
  // Leaf insertion unsuccessful? Overflow and try again.
1852
5.62M
  if (Size > Leaf::Capacity) {
1853
1.26M
    overflow<Leaf>(P.height());
1854
1.26M
    Grow = P.leafOffset() == P.leafSize();
1855
1.26M
    Size = P.leaf<Leaf>().insertFrom(P.leafOffset(), P.leafSize(), a, b, y);
1856
1.26M
    assert(Size <= Leaf::Capacity && "overflow() didn't make room");
1857
1.26M
  }
1858
5.62M
1859
5.62M
  // Inserted, update offset and leaf size.
1860
5.62M
  P.setSize(P.height(), Size);
1861
5.62M
1862
5.62M
  // Insert was the last node entry, update stops.
1863
5.62M
  if (Grow)
1864
1.22M
    setNodeStop(P.height(), b);
1865
5.62M
}
llvm::IntervalMap<llvm::SlotIndex, DbgValueLocation, 4u, llvm::IntervalMapInfo<llvm::SlotIndex> >::iterator::treeInsert(llvm::SlotIndex, llvm::SlotIndex, DbgValueLocation)
Line
Count
Source
1806
47
iterator::treeInsert(KeyT a, KeyT b, ValT y) {
1807
47
  using namespace IntervalMapImpl;
1808
47
  Path &P = this->path;
1809
47
1810
47
  if (!P.valid())
1811
11
    P.legalizeForInsert(this->map->height);
1812
47
1813
47
  // Check if this insertion will extend the node to the left.
1814
47
  if (P.leafOffset() == 0 && 
Traits::startLess(a, P.leaf<Leaf>().start(0))0
) {
1815
0
    // Node is growing to the left, will it affect a left sibling node?
1816
0
    if (NodeRef Sib = P.getLeftSibling(P.height())) {
1817
0
      Leaf &SibLeaf = Sib.get<Leaf>();
1818
0
      unsigned SibOfs = Sib.size() - 1;
1819
0
      if (SibLeaf.value(SibOfs) == y &&
1820
0
          Traits::adjacent(SibLeaf.stop(SibOfs), a)) {
1821
0
        // This insertion will coalesce with the last entry in SibLeaf. We can
1822
0
        // handle it in two ways:
1823
0
        //  1. Extend SibLeaf.stop to b and be done, or
1824
0
        //  2. Extend a to SibLeaf, erase the SibLeaf entry and continue.
1825
0
        // We prefer 1., but need 2 when coalescing to the right as well.
1826
0
        Leaf &CurLeaf = P.leaf<Leaf>();
1827
0
        P.moveLeft(P.height());
1828
0
        if (Traits::stopLess(b, CurLeaf.start(0)) &&
1829
0
            (y != CurLeaf.value(0) || !Traits::adjacent(b, CurLeaf.start(0)))) {
1830
0
          // Easy, just extend SibLeaf and we're done.
1831
0
          setNodeStop(P.height(), SibLeaf.stop(SibOfs) = b);
1832
0
          return;
1833
0
        } else {
1834
0
          // We have both left and right coalescing. Erase the old SibLeaf entry
1835
0
          // and continue inserting the larger interval.
1836
0
          a = SibLeaf.start(SibOfs);
1837
0
          treeErase(/* UpdateRoot= */false);
1838
0
        }
1839
0
      }
1840
0
    } else {
1841
0
      // No left sibling means we are at begin(). Update cached bound.
1842
0
      this->map->rootBranchStart() = a;
1843
0
    }
1844
0
  }
1845
47
1846
47
  // When we are inserting at the end of a leaf node, we must update stops.
1847
47
  unsigned Size = P.leafSize();
1848
47
  bool Grow = P.leafOffset() == Size;
1849
47
  Size = P.leaf<Leaf>().insertFrom(P.leafOffset(), Size, a, b, y);
1850
47
1851
47
  // Leaf insertion unsuccessful? Overflow and try again.
1852
47
  if (Size > Leaf::Capacity) {
1853
0
    overflow<Leaf>(P.height());
1854
0
    Grow = P.leafOffset() == P.leafSize();
1855
0
    Size = P.leaf<Leaf>().insertFrom(P.leafOffset(), P.leafSize(), a, b, y);
1856
0
    assert(Size <= Leaf::Capacity && "overflow() didn't make room");
1857
0
  }
1858
47
1859
47
  // Inserted, update offset and leaf size.
1860
47
  P.setSize(P.height(), Size);
1861
47
1862
47
  // Insert was the last node entry, update stops.
1863
47
  if (Grow)
1864
16
    setNodeStop(P.height(), b);
1865
47
}
llvm::IntervalMap<llvm::SlotIndex, llvm::LiveInterval*, 8u, llvm::IntervalMapInfo<llvm::SlotIndex> >::iterator::treeInsert(llvm::SlotIndex, llvm::SlotIndex, llvm::LiveInterval*)
Line
Count
Source
1806
4.89M
iterator::treeInsert(KeyT a, KeyT b, ValT y) {
1807
4.89M
  using namespace IntervalMapImpl;
1808
4.89M
  Path &P = this->path;
1809
4.89M
1810
4.89M
  if (!P.valid())
1811
973k
    P.legalizeForInsert(this->map->height);
1812
4.89M
1813
4.89M
  // Check if this insertion will extend the node to the left.
1814
4.89M
  if (P.leafOffset() == 0 && 
Traits::startLess(a, P.leaf<Leaf>().start(0))328k
) {
1815
328k
    // Node is growing to the left, will it affect a left sibling node?
1816
328k
    if (NodeRef Sib = P.getLeftSibling(P.height()))