Coverage Report

Created: 2024-01-17 10:31

/src/llvm-project/llvm/lib/IR/LLVMContextImpl.h
Line
Count
Source (jump to first uncovered line)
1
//===- LLVMContextImpl.h - The LLVMContextImpl opaque class -----*- 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 declares LLVMContextImpl, the opaque implementation
10
//  of LLVMContext.
11
//
12
//===----------------------------------------------------------------------===//
13
14
#ifndef LLVM_LIB_IR_LLVMCONTEXTIMPL_H
15
#define LLVM_LIB_IR_LLVMCONTEXTIMPL_H
16
17
#include "ConstantsContext.h"
18
#include "llvm/ADT/APFloat.h"
19
#include "llvm/ADT/APInt.h"
20
#include "llvm/ADT/ArrayRef.h"
21
#include "llvm/ADT/DenseMap.h"
22
#include "llvm/ADT/DenseMapInfo.h"
23
#include "llvm/ADT/DenseSet.h"
24
#include "llvm/ADT/FoldingSet.h"
25
#include "llvm/ADT/Hashing.h"
26
#include "llvm/ADT/STLExtras.h"
27
#include "llvm/ADT/SmallPtrSet.h"
28
#include "llvm/ADT/SmallVector.h"
29
#include "llvm/ADT/StringMap.h"
30
#include "llvm/BinaryFormat/Dwarf.h"
31
#include "llvm/IR/Constants.h"
32
#include "llvm/IR/DebugInfoMetadata.h"
33
#include "llvm/IR/DerivedTypes.h"
34
#include "llvm/IR/LLVMContext.h"
35
#include "llvm/IR/Metadata.h"
36
#include "llvm/IR/Module.h"
37
#include "llvm/IR/TrackingMDRef.h"
38
#include "llvm/IR/Type.h"
39
#include "llvm/IR/Value.h"
40
#include "llvm/Support/Allocator.h"
41
#include "llvm/Support/Casting.h"
42
#include "llvm/Support/StringSaver.h"
43
#include <algorithm>
44
#include <cassert>
45
#include <cstddef>
46
#include <cstdint>
47
#include <memory>
48
#include <optional>
49
#include <string>
50
#include <utility>
51
#include <vector>
52
53
namespace llvm {
54
55
class AttributeImpl;
56
class AttributeListImpl;
57
class AttributeSetNode;
58
class BasicBlock;
59
struct DiagnosticHandler;
60
class DPMarker;
61
class ElementCount;
62
class Function;
63
class GlobalObject;
64
class GlobalValue;
65
class InlineAsm;
66
class LLVMRemarkStreamer;
67
class OptPassGate;
68
namespace remarks {
69
class RemarkStreamer;
70
}
71
template <typename T> class StringMapEntry;
72
class StringRef;
73
class TypedPointerType;
74
class ValueHandleBase;
75
76
template <> struct DenseMapInfo<APFloat> {
77
1.82M
  static inline APFloat getEmptyKey() { return APFloat(APFloat::Bogus(), 1); }
78
1.21M
  static inline APFloat getTombstoneKey() {
79
1.21M
    return APFloat(APFloat::Bogus(), 2);
80
1.21M
  }
81
82
1.00M
  static unsigned getHashValue(const APFloat &Key) {
83
1.00M
    return static_cast<unsigned>(hash_value(Key));
84
1.00M
  }
85
86
18.9M
  static bool isEqual(const APFloat &LHS, const APFloat &RHS) {
87
18.9M
    return LHS.bitwiseIsEqual(RHS);
88
18.9M
  }
89
};
90
91
struct AnonStructTypeKeyInfo {
92
  struct KeyTy {
93
    ArrayRef<Type *> ETypes;
94
    bool isPacked;
95
96
25.1k
    KeyTy(const ArrayRef<Type *> &E, bool P) : ETypes(E), isPacked(P) {}
97
98
    KeyTy(const StructType *ST)
99
29.3k
        : ETypes(ST->elements()), isPacked(ST->isPacked()) {}
100
101
19.5k
    bool operator==(const KeyTy &that) const {
102
19.5k
      if (isPacked != that.isPacked)
103
31
        return false;
104
19.4k
      if (ETypes != that.ETypes)
105
11.1k
        return false;
106
8.35k
      return true;
107
19.4k
    }
108
0
    bool operator!=(const KeyTy &that) const { return !this->operator==(that); }
109
  };
110
111
148k
  static inline StructType *getEmptyKey() {
112
148k
    return DenseMapInfo<StructType *>::getEmptyKey();
113
148k
  }
114
115
84.6k
  static inline StructType *getTombstoneKey() {
116
84.6k
    return DenseMapInfo<StructType *>::getTombstoneKey();
117
84.6k
  }
118
119
35.0k
  static unsigned getHashValue(const KeyTy &Key) {
120
35.0k
    return hash_combine(
121
35.0k
        hash_combine_range(Key.ETypes.begin(), Key.ETypes.end()), Key.isPacked);
122
35.0k
  }
123
124
9.82k
  static unsigned getHashValue(const StructType *ST) {
125
9.82k
    return getHashValue(KeyTy(ST));
126
9.82k
  }
127
128
86.7k
  static bool isEqual(const KeyTy &LHS, const StructType *RHS) {
129
86.7k
    if (RHS == getEmptyKey() || RHS == getTombstoneKey())
130
67.2k
      return false;
131
19.5k
    return LHS == KeyTy(RHS);
132
86.7k
  }
133
134
464k
  static bool isEqual(const StructType *LHS, const StructType *RHS) {
135
464k
    return LHS == RHS;
136
464k
  }
137
};
138
139
struct FunctionTypeKeyInfo {
140
  struct KeyTy {
141
    const Type *ReturnType;
142
    ArrayRef<Type *> Params;
143
    bool isVarArg;
144
145
    KeyTy(const Type *R, const ArrayRef<Type *> &P, bool V)
146
560k
        : ReturnType(R), Params(P), isVarArg(V) {}
147
    KeyTy(const FunctionType *FT)
148
        : ReturnType(FT->getReturnType()), Params(FT->params()),
149
291k
          isVarArg(FT->isVarArg()) {}
150
151
215k
    bool operator==(const KeyTy &that) const {
152
215k
      if (ReturnType != that.ReturnType)
153
133k
        return false;
154
81.5k
      if (isVarArg != that.isVarArg)
155
362
        return false;
156
81.2k
      if (Params != that.Params)
157
17.6k
        return false;
158
63.5k
      return true;
159
81.2k
    }
160
0
    bool operator!=(const KeyTy &that) const { return !this->operator==(that); }
161
  };
162
163
3.30M
  static inline FunctionType *getEmptyKey() {
164
3.30M
    return DenseMapInfo<FunctionType *>::getEmptyKey();
165
3.30M
  }
166
167
1.57M
  static inline FunctionType *getTombstoneKey() {
168
1.57M
    return DenseMapInfo<FunctionType *>::getTombstoneKey();
169
1.57M
  }
170
171
638k
  static unsigned getHashValue(const KeyTy &Key) {
172
638k
    return hash_combine(
173
638k
        Key.ReturnType,
174
638k
        hash_combine_range(Key.Params.begin(), Key.Params.end()), Key.isVarArg);
175
638k
  }
176
177
76.1k
  static unsigned getHashValue(const FunctionType *FT) {
178
76.1k
    return getHashValue(KeyTy(FT));
179
76.1k
  }
180
181
1.83M
  static bool isEqual(const KeyTy &LHS, const FunctionType *RHS) {
182
1.83M
    if (RHS == getEmptyKey() || RHS == getTombstoneKey())
183
1.62M
      return false;
184
215k
    return LHS == KeyTy(RHS);
185
1.83M
  }
186
187
12.7M
  static bool isEqual(const FunctionType *LHS, const FunctionType *RHS) {
188
12.7M
    return LHS == RHS;
189
12.7M
  }
190
};
191
192
struct TargetExtTypeKeyInfo {
193
  struct KeyTy {
194
    StringRef Name;
195
    ArrayRef<Type *> TypeParams;
196
    ArrayRef<unsigned> IntParams;
197
198
    KeyTy(StringRef N, const ArrayRef<Type *> &TP, const ArrayRef<unsigned> &IP)
199
4.07k
        : Name(N), TypeParams(TP), IntParams(IP) {}
200
    KeyTy(const TargetExtType *TT)
201
        : Name(TT->getName()), TypeParams(TT->type_params()),
202
4.16k
          IntParams(TT->int_params()) {}
203
204
3.93k
    bool operator==(const KeyTy &that) const {
205
3.93k
      return Name == that.Name && TypeParams == that.TypeParams &&
206
3.93k
             IntParams == that.IntParams;
207
3.93k
    }
208
0
    bool operator!=(const KeyTy &that) const { return !this->operator==(that); }
209
  };
210
211
19.8k
  static inline TargetExtType *getEmptyKey() {
212
19.8k
    return DenseMapInfo<TargetExtType *>::getEmptyKey();
213
19.8k
  }
214
215
12.4k
  static inline TargetExtType *getTombstoneKey() {
216
12.4k
    return DenseMapInfo<TargetExtType *>::getTombstoneKey();
217
12.4k
  }
218
219
4.31k
  static unsigned getHashValue(const KeyTy &Key) {
220
4.31k
    return hash_combine(
221
4.31k
        Key.Name,
222
4.31k
        hash_combine_range(Key.TypeParams.begin(), Key.TypeParams.end()),
223
4.31k
        hash_combine_range(Key.IntParams.begin(), Key.IntParams.end()));
224
4.31k
  }
225
226
235
  static unsigned getHashValue(const TargetExtType *FT) {
227
235
    return getHashValue(KeyTy(FT));
228
235
  }
229
230
13.7k
  static bool isEqual(const KeyTy &LHS, const TargetExtType *RHS) {
231
13.7k
    if (RHS == getEmptyKey() || RHS == getTombstoneKey())
232
9.78k
      return false;
233
3.93k
    return LHS == KeyTy(RHS);
234
13.7k
  }
235
236
17.0k
  static bool isEqual(const TargetExtType *LHS, const TargetExtType *RHS) {
237
17.0k
    return LHS == RHS;
238
17.0k
  }
239
};
240
241
/// Structure for hashing arbitrary MDNode operands.
242
class MDNodeOpsKey {
243
  ArrayRef<Metadata *> RawOps;
244
  ArrayRef<MDOperand> Ops;
245
  unsigned Hash;
246
247
protected:
248
  MDNodeOpsKey(ArrayRef<Metadata *> Ops)
249
174k
      : RawOps(Ops), Hash(calculateHash(Ops)) {}
250
251
  template <class NodeTy>
252
  MDNodeOpsKey(const NodeTy *N, unsigned Offset = 0)
253
1.45M
      : Ops(N->op_begin() + Offset, N->op_end()), Hash(N->getHash()) {}
llvm::MDNodeOpsKey::MDNodeOpsKey<llvm::GenericDINode>(llvm::GenericDINode const*, unsigned int)
Line
Count
Source
253
17
      : Ops(N->op_begin() + Offset, N->op_end()), Hash(N->getHash()) {}
llvm::MDNodeOpsKey::MDNodeOpsKey<llvm::MDTuple>(llvm::MDTuple const*, unsigned int)
Line
Count
Source
253
1.45M
      : Ops(N->op_begin() + Offset, N->op_end()), Hash(N->getHash()) {}
254
255
  template <class NodeTy>
256
285k
  bool compareOps(const NodeTy *RHS, unsigned Offset = 0) const {
257
285k
    if (getHash() != RHS->getHash())
258
223k
      return false;
259
260
62.7k
    assert((RawOps.empty() || Ops.empty()) && "Two sets of operands?");
261
62.7k
    return RawOps.empty() ? compareOps(Ops, RHS, Offset)
262
62.7k
                          : compareOps(RawOps, RHS, Offset);
263
285k
  }
bool llvm::MDNodeOpsKey::compareOps<llvm::MDTuple>(llvm::MDTuple const*, unsigned int) const
Line
Count
Source
256
285k
  bool compareOps(const NodeTy *RHS, unsigned Offset = 0) const {
257
285k
    if (getHash() != RHS->getHash())
258
223k
      return false;
259
260
62.7k
    assert((RawOps.empty() || Ops.empty()) && "Two sets of operands?");
261
62.7k
    return RawOps.empty() ? compareOps(Ops, RHS, Offset)
262
62.7k
                          : compareOps(RawOps, RHS, Offset);
263
285k
  }
Unexecuted instantiation: bool llvm::MDNodeOpsKey::compareOps<llvm::GenericDINode>(llvm::GenericDINode const*, unsigned int) const
264
265
  static unsigned calculateHash(MDNode *N, unsigned Offset = 0);
266
267
private:
268
  template <class T>
269
62.7k
  static bool compareOps(ArrayRef<T> Ops, const MDNode *RHS, unsigned Offset) {
270
62.7k
    if (Ops.size() != RHS->getNumOperands() - Offset)
271
0
      return false;
272
62.7k
    return std::equal(Ops.begin(), Ops.end(), RHS->op_begin() + Offset);
273
62.7k
  }
bool llvm::MDNodeOpsKey::compareOps<llvm::MDOperand>(llvm::ArrayRef<llvm::MDOperand>, llvm::MDNode const*, unsigned int)
Line
Count
Source
269
9.11k
  static bool compareOps(ArrayRef<T> Ops, const MDNode *RHS, unsigned Offset) {
270
9.11k
    if (Ops.size() != RHS->getNumOperands() - Offset)
271
0
      return false;
272
9.11k
    return std::equal(Ops.begin(), Ops.end(), RHS->op_begin() + Offset);
273
9.11k
  }
bool llvm::MDNodeOpsKey::compareOps<llvm::Metadata*>(llvm::ArrayRef<llvm::Metadata*>, llvm::MDNode const*, unsigned int)
Line
Count
Source
269
53.5k
  static bool compareOps(ArrayRef<T> Ops, const MDNode *RHS, unsigned Offset) {
270
53.5k
    if (Ops.size() != RHS->getNumOperands() - Offset)
271
0
      return false;
272
53.5k
    return std::equal(Ops.begin(), Ops.end(), RHS->op_begin() + Offset);
273
53.5k
  }
274
275
  static unsigned calculateHash(ArrayRef<Metadata *> Ops);
276
277
public:
278
2.01M
  unsigned getHash() const { return Hash; }
279
};
280
281
template <class NodeTy> struct MDNodeKeyImpl;
282
283
/// Configuration point for MDNodeInfo::isEqual().
284
template <class NodeTy> struct MDNodeSubsetEqualImpl {
285
  using KeyTy = MDNodeKeyImpl<NodeTy>;
286
287
325k
  static bool isSubsetEqual(const KeyTy &LHS, const NodeTy *RHS) {
288
325k
    return false;
289
325k
  }
llvm::MDNodeSubsetEqualImpl<llvm::DILocation>::isSubsetEqual(llvm::MDNodeKeyImpl<llvm::DILocation> const&, llvm::DILocation const*)
Line
Count
Source
287
8.90k
  static bool isSubsetEqual(const KeyTy &LHS, const NodeTy *RHS) {
288
8.90k
    return false;
289
8.90k
  }
Unexecuted instantiation: llvm::MDNodeSubsetEqualImpl<llvm::GenericDINode>::isSubsetEqual(llvm::MDNodeKeyImpl<llvm::GenericDINode> const&, llvm::GenericDINode const*)
Unexecuted instantiation: llvm::MDNodeSubsetEqualImpl<llvm::DISubrange>::isSubsetEqual(llvm::MDNodeKeyImpl<llvm::DISubrange> const&, llvm::DISubrange const*)
Unexecuted instantiation: llvm::MDNodeSubsetEqualImpl<llvm::DIGenericSubrange>::isSubsetEqual(llvm::MDNodeKeyImpl<llvm::DIGenericSubrange> const&, llvm::DIGenericSubrange const*)
Unexecuted instantiation: llvm::MDNodeSubsetEqualImpl<llvm::DIEnumerator>::isSubsetEqual(llvm::MDNodeKeyImpl<llvm::DIEnumerator> const&, llvm::DIEnumerator const*)
llvm::MDNodeSubsetEqualImpl<llvm::DIBasicType>::isSubsetEqual(llvm::MDNodeKeyImpl<llvm::DIBasicType> const&, llvm::DIBasicType const*)
Line
Count
Source
287
27
  static bool isSubsetEqual(const KeyTy &LHS, const NodeTy *RHS) {
288
27
    return false;
289
27
  }
Unexecuted instantiation: llvm::MDNodeSubsetEqualImpl<llvm::DIStringType>::isSubsetEqual(llvm::MDNodeKeyImpl<llvm::DIStringType> const&, llvm::DIStringType const*)
Unexecuted instantiation: llvm::MDNodeSubsetEqualImpl<llvm::DICompositeType>::isSubsetEqual(llvm::MDNodeKeyImpl<llvm::DICompositeType> const&, llvm::DICompositeType const*)
llvm::MDNodeSubsetEqualImpl<llvm::DISubroutineType>::isSubsetEqual(llvm::MDNodeKeyImpl<llvm::DISubroutineType> const&, llvm::DISubroutineType const*)
Line
Count
Source
287
2
  static bool isSubsetEqual(const KeyTy &LHS, const NodeTy *RHS) {
288
2
    return false;
289
2
  }
llvm::MDNodeSubsetEqualImpl<llvm::DIFile>::isSubsetEqual(llvm::MDNodeKeyImpl<llvm::DIFile> const&, llvm::DIFile const*)
Line
Count
Source
287
3
  static bool isSubsetEqual(const KeyTy &LHS, const NodeTy *RHS) {
288
3
    return false;
289
3
  }
Unexecuted instantiation: llvm::MDNodeSubsetEqualImpl<llvm::DILexicalBlock>::isSubsetEqual(llvm::MDNodeKeyImpl<llvm::DILexicalBlock> const&, llvm::DILexicalBlock const*)
llvm::MDNodeSubsetEqualImpl<llvm::DILexicalBlockFile>::isSubsetEqual(llvm::MDNodeKeyImpl<llvm::DILexicalBlockFile> const&, llvm::DILexicalBlockFile const*)
Line
Count
Source
287
2
  static bool isSubsetEqual(const KeyTy &LHS, const NodeTy *RHS) {
288
2
    return false;
289
2
  }
Unexecuted instantiation: llvm::MDNodeSubsetEqualImpl<llvm::DINamespace>::isSubsetEqual(llvm::MDNodeKeyImpl<llvm::DINamespace> const&, llvm::DINamespace const*)
Unexecuted instantiation: llvm::MDNodeSubsetEqualImpl<llvm::DICommonBlock>::isSubsetEqual(llvm::MDNodeKeyImpl<llvm::DICommonBlock> const&, llvm::DICommonBlock const*)
Unexecuted instantiation: llvm::MDNodeSubsetEqualImpl<llvm::DIModule>::isSubsetEqual(llvm::MDNodeKeyImpl<llvm::DIModule> const&, llvm::DIModule const*)
Unexecuted instantiation: llvm::MDNodeSubsetEqualImpl<llvm::DITemplateTypeParameter>::isSubsetEqual(llvm::MDNodeKeyImpl<llvm::DITemplateTypeParameter> const&, llvm::DITemplateTypeParameter const*)
Unexecuted instantiation: llvm::MDNodeSubsetEqualImpl<llvm::DITemplateValueParameter>::isSubsetEqual(llvm::MDNodeKeyImpl<llvm::DITemplateValueParameter> const&, llvm::DITemplateValueParameter const*)
llvm::MDNodeSubsetEqualImpl<llvm::DIGlobalVariable>::isSubsetEqual(llvm::MDNodeKeyImpl<llvm::DIGlobalVariable> const&, llvm::DIGlobalVariable const*)
Line
Count
Source
287
8
  static bool isSubsetEqual(const KeyTy &LHS, const NodeTy *RHS) {
288
8
    return false;
289
8
  }
llvm::MDNodeSubsetEqualImpl<llvm::DILocalVariable>::isSubsetEqual(llvm::MDNodeKeyImpl<llvm::DILocalVariable> const&, llvm::DILocalVariable const*)
Line
Count
Source
287
243
  static bool isSubsetEqual(const KeyTy &LHS, const NodeTy *RHS) {
288
243
    return false;
289
243
  }
Unexecuted instantiation: llvm::MDNodeSubsetEqualImpl<llvm::DILabel>::isSubsetEqual(llvm::MDNodeKeyImpl<llvm::DILabel> const&, llvm::DILabel const*)
llvm::MDNodeSubsetEqualImpl<llvm::DIExpression>::isSubsetEqual(llvm::MDNodeKeyImpl<llvm::DIExpression> const&, llvm::DIExpression const*)
Line
Count
Source
287
30.3k
  static bool isSubsetEqual(const KeyTy &LHS, const NodeTy *RHS) {
288
30.3k
    return false;
289
30.3k
  }
llvm::MDNodeSubsetEqualImpl<llvm::DIGlobalVariableExpression>::isSubsetEqual(llvm::MDNodeKeyImpl<llvm::DIGlobalVariableExpression> const&, llvm::DIGlobalVariableExpression const*)
Line
Count
Source
287
10
  static bool isSubsetEqual(const KeyTy &LHS, const NodeTy *RHS) {
288
10
    return false;
289
10
  }
Unexecuted instantiation: llvm::MDNodeSubsetEqualImpl<llvm::DIObjCProperty>::isSubsetEqual(llvm::MDNodeKeyImpl<llvm::DIObjCProperty> const&, llvm::DIObjCProperty const*)
Unexecuted instantiation: llvm::MDNodeSubsetEqualImpl<llvm::DIImportedEntity>::isSubsetEqual(llvm::MDNodeKeyImpl<llvm::DIImportedEntity> const&, llvm::DIImportedEntity const*)
Unexecuted instantiation: llvm::MDNodeSubsetEqualImpl<llvm::DIMacro>::isSubsetEqual(llvm::MDNodeKeyImpl<llvm::DIMacro> const&, llvm::DIMacro const*)
Unexecuted instantiation: llvm::MDNodeSubsetEqualImpl<llvm::DIMacroFile>::isSubsetEqual(llvm::MDNodeKeyImpl<llvm::DIMacroFile> const&, llvm::DIMacroFile const*)
llvm::MDNodeSubsetEqualImpl<llvm::MDTuple>::isSubsetEqual(llvm::MDNodeKeyImpl<llvm::MDTuple> const&, llvm::MDTuple const*)
Line
Count
Source
287
285k
  static bool isSubsetEqual(const KeyTy &LHS, const NodeTy *RHS) {
288
285k
    return false;
289
285k
  }
290
291
368k
  static bool isSubsetEqual(const NodeTy *LHS, const NodeTy *RHS) {
292
368k
    return false;
293
368k
  }
llvm::MDNodeSubsetEqualImpl<llvm::DILocation>::isSubsetEqual(llvm::DILocation const*, llvm::DILocation const*)
Line
Count
Source
291
2.31k
  static bool isSubsetEqual(const NodeTy *LHS, const NodeTy *RHS) {
292
2.31k
    return false;
293
2.31k
  }
Unexecuted instantiation: llvm::MDNodeSubsetEqualImpl<llvm::GenericDINode>::isSubsetEqual(llvm::GenericDINode const*, llvm::GenericDINode const*)
Unexecuted instantiation: llvm::MDNodeSubsetEqualImpl<llvm::DISubrange>::isSubsetEqual(llvm::DISubrange const*, llvm::DISubrange const*)
Unexecuted instantiation: llvm::MDNodeSubsetEqualImpl<llvm::DIGenericSubrange>::isSubsetEqual(llvm::DIGenericSubrange const*, llvm::DIGenericSubrange const*)
Unexecuted instantiation: llvm::MDNodeSubsetEqualImpl<llvm::DIEnumerator>::isSubsetEqual(llvm::DIEnumerator const*, llvm::DIEnumerator const*)
llvm::MDNodeSubsetEqualImpl<llvm::DIBasicType>::isSubsetEqual(llvm::DIBasicType const*, llvm::DIBasicType const*)
Line
Count
Source
291
27
  static bool isSubsetEqual(const NodeTy *LHS, const NodeTy *RHS) {
292
27
    return false;
293
27
  }
Unexecuted instantiation: llvm::MDNodeSubsetEqualImpl<llvm::DIStringType>::isSubsetEqual(llvm::DIStringType const*, llvm::DIStringType const*)
Unexecuted instantiation: llvm::MDNodeSubsetEqualImpl<llvm::DICompositeType>::isSubsetEqual(llvm::DICompositeType const*, llvm::DICompositeType const*)
llvm::MDNodeSubsetEqualImpl<llvm::DISubroutineType>::isSubsetEqual(llvm::DISubroutineType const*, llvm::DISubroutineType const*)
Line
Count
Source
291
2
  static bool isSubsetEqual(const NodeTy *LHS, const NodeTy *RHS) {
292
2
    return false;
293
2
  }
llvm::MDNodeSubsetEqualImpl<llvm::DIFile>::isSubsetEqual(llvm::DIFile const*, llvm::DIFile const*)
Line
Count
Source
291
3
  static bool isSubsetEqual(const NodeTy *LHS, const NodeTy *RHS) {
292
3
    return false;
293
3
  }
Unexecuted instantiation: llvm::MDNodeSubsetEqualImpl<llvm::DILexicalBlock>::isSubsetEqual(llvm::DILexicalBlock const*, llvm::DILexicalBlock const*)
llvm::MDNodeSubsetEqualImpl<llvm::DILexicalBlockFile>::isSubsetEqual(llvm::DILexicalBlockFile const*, llvm::DILexicalBlockFile const*)
Line
Count
Source
291
2
  static bool isSubsetEqual(const NodeTy *LHS, const NodeTy *RHS) {
292
2
    return false;
293
2
  }
Unexecuted instantiation: llvm::MDNodeSubsetEqualImpl<llvm::DINamespace>::isSubsetEqual(llvm::DINamespace const*, llvm::DINamespace const*)
Unexecuted instantiation: llvm::MDNodeSubsetEqualImpl<llvm::DICommonBlock>::isSubsetEqual(llvm::DICommonBlock const*, llvm::DICommonBlock const*)
Unexecuted instantiation: llvm::MDNodeSubsetEqualImpl<llvm::DIModule>::isSubsetEqual(llvm::DIModule const*, llvm::DIModule const*)
Unexecuted instantiation: llvm::MDNodeSubsetEqualImpl<llvm::DITemplateTypeParameter>::isSubsetEqual(llvm::DITemplateTypeParameter const*, llvm::DITemplateTypeParameter const*)
Unexecuted instantiation: llvm::MDNodeSubsetEqualImpl<llvm::DITemplateValueParameter>::isSubsetEqual(llvm::DITemplateValueParameter const*, llvm::DITemplateValueParameter const*)
llvm::MDNodeSubsetEqualImpl<llvm::DIGlobalVariable>::isSubsetEqual(llvm::DIGlobalVariable const*, llvm::DIGlobalVariable const*)
Line
Count
Source
291
9
  static bool isSubsetEqual(const NodeTy *LHS, const NodeTy *RHS) {
292
9
    return false;
293
9
  }
llvm::MDNodeSubsetEqualImpl<llvm::DILocalVariable>::isSubsetEqual(llvm::DILocalVariable const*, llvm::DILocalVariable const*)
Line
Count
Source
291
244
  static bool isSubsetEqual(const NodeTy *LHS, const NodeTy *RHS) {
292
244
    return false;
293
244
  }
Unexecuted instantiation: llvm::MDNodeSubsetEqualImpl<llvm::DILabel>::isSubsetEqual(llvm::DILabel const*, llvm::DILabel const*)
llvm::MDNodeSubsetEqualImpl<llvm::DIExpression>::isSubsetEqual(llvm::DIExpression const*, llvm::DIExpression const*)
Line
Count
Source
291
19.3k
  static bool isSubsetEqual(const NodeTy *LHS, const NodeTy *RHS) {
292
19.3k
    return false;
293
19.3k
  }
llvm::MDNodeSubsetEqualImpl<llvm::DIGlobalVariableExpression>::isSubsetEqual(llvm::DIGlobalVariableExpression const*, llvm::DIGlobalVariableExpression const*)
Line
Count
Source
291
10
  static bool isSubsetEqual(const NodeTy *LHS, const NodeTy *RHS) {
292
10
    return false;
293
10
  }
Unexecuted instantiation: llvm::MDNodeSubsetEqualImpl<llvm::DIObjCProperty>::isSubsetEqual(llvm::DIObjCProperty const*, llvm::DIObjCProperty const*)
Unexecuted instantiation: llvm::MDNodeSubsetEqualImpl<llvm::DIImportedEntity>::isSubsetEqual(llvm::DIImportedEntity const*, llvm::DIImportedEntity const*)
Unexecuted instantiation: llvm::MDNodeSubsetEqualImpl<llvm::DIMacro>::isSubsetEqual(llvm::DIMacro const*, llvm::DIMacro const*)
Unexecuted instantiation: llvm::MDNodeSubsetEqualImpl<llvm::DIMacroFile>::isSubsetEqual(llvm::DIMacroFile const*, llvm::DIMacroFile const*)
llvm::MDNodeSubsetEqualImpl<llvm::MDTuple>::isSubsetEqual(llvm::MDTuple const*, llvm::MDTuple const*)
Line
Count
Source
291
346k
  static bool isSubsetEqual(const NodeTy *LHS, const NodeTy *RHS) {
292
346k
    return false;
293
346k
  }
294
};
295
296
/// DenseMapInfo for MDTuple.
297
///
298
/// Note that we don't need the is-function-local bit, since that's implicit in
299
/// the operands.
300
template <> struct MDNodeKeyImpl<MDTuple> : MDNodeOpsKey {
301
174k
  MDNodeKeyImpl(ArrayRef<Metadata *> Ops) : MDNodeOpsKey(Ops) {}
302
1.45M
  MDNodeKeyImpl(const MDTuple *N) : MDNodeOpsKey(N) {}
303
304
285k
  bool isKeyOf(const MDTuple *RHS) const { return compareOps(RHS); }
305
306
1.61M
  unsigned getHashValue() const { return getHash(); }
307
308
404k
  static unsigned calculateHash(MDTuple *N) {
309
404k
    return MDNodeOpsKey::calculateHash(N);
310
404k
  }
311
};
312
313
/// DenseMapInfo for DILocation.
314
template <> struct MDNodeKeyImpl<DILocation> {
315
  unsigned Line;
316
  unsigned Column;
317
  Metadata *Scope;
318
  Metadata *InlinedAt;
319
  bool ImplicitCode;
320
321
  MDNodeKeyImpl(unsigned Line, unsigned Column, Metadata *Scope,
322
                Metadata *InlinedAt, bool ImplicitCode)
323
      : Line(Line), Column(Column), Scope(Scope), InlinedAt(InlinedAt),
324
31.3k
        ImplicitCode(ImplicitCode) {}
325
  MDNodeKeyImpl(const DILocation *L)
326
      : Line(L->getLine()), Column(L->getColumn()), Scope(L->getRawScope()),
327
25.2k
        InlinedAt(L->getRawInlinedAt()), ImplicitCode(L->isImplicitCode()) {}
328
329
8.90k
  bool isKeyOf(const DILocation *RHS) const {
330
8.90k
    return Line == RHS->getLine() && Column == RHS->getColumn() &&
331
8.90k
           Scope == RHS->getRawScope() && InlinedAt == RHS->getRawInlinedAt() &&
332
8.90k
           ImplicitCode == RHS->isImplicitCode();
333
8.90k
  }
334
335
51.6k
  unsigned getHashValue() const {
336
51.6k
    return hash_combine(Line, Column, Scope, InlinedAt, ImplicitCode);
337
51.6k
  }
338
};
339
340
/// DenseMapInfo for GenericDINode.
341
template <> struct MDNodeKeyImpl<GenericDINode> : MDNodeOpsKey {
342
  unsigned Tag;
343
  MDString *Header;
344
345
  MDNodeKeyImpl(unsigned Tag, MDString *Header, ArrayRef<Metadata *> DwarfOps)
346
17
      : MDNodeOpsKey(DwarfOps), Tag(Tag), Header(Header) {}
347
  MDNodeKeyImpl(const GenericDINode *N)
348
17
      : MDNodeOpsKey(N, 1), Tag(N->getTag()), Header(N->getRawHeader()) {}
349
350
0
  bool isKeyOf(const GenericDINode *RHS) const {
351
0
    return Tag == RHS->getTag() && Header == RHS->getRawHeader() &&
352
0
           compareOps(RHS, 1);
353
0
  }
354
355
17
  unsigned getHashValue() const { return hash_combine(getHash(), Tag, Header); }
356
357
0
  static unsigned calculateHash(GenericDINode *N) {
358
0
    return MDNodeOpsKey::calculateHash(N, 1);
359
0
  }
360
};
361
362
template <> struct MDNodeKeyImpl<DISubrange> {
363
  Metadata *CountNode;
364
  Metadata *LowerBound;
365
  Metadata *UpperBound;
366
  Metadata *Stride;
367
368
  MDNodeKeyImpl(Metadata *CountNode, Metadata *LowerBound, Metadata *UpperBound,
369
                Metadata *Stride)
370
      : CountNode(CountNode), LowerBound(LowerBound), UpperBound(UpperBound),
371
275
        Stride(Stride) {}
372
  MDNodeKeyImpl(const DISubrange *N)
373
      : CountNode(N->getRawCountNode()), LowerBound(N->getRawLowerBound()),
374
275
        UpperBound(N->getRawUpperBound()), Stride(N->getRawStride()) {}
375
376
0
  bool isKeyOf(const DISubrange *RHS) const {
377
0
    auto BoundsEqual = [=](Metadata *Node1, Metadata *Node2) -> bool {
378
0
      if (Node1 == Node2)
379
0
        return true;
380
381
0
      ConstantAsMetadata *MD1 = dyn_cast_or_null<ConstantAsMetadata>(Node1);
382
0
      ConstantAsMetadata *MD2 = dyn_cast_or_null<ConstantAsMetadata>(Node2);
383
0
      if (MD1 && MD2) {
384
0
        ConstantInt *CV1 = cast<ConstantInt>(MD1->getValue());
385
0
        ConstantInt *CV2 = cast<ConstantInt>(MD2->getValue());
386
0
        if (CV1->getSExtValue() == CV2->getSExtValue())
387
0
          return true;
388
0
      }
389
0
      return false;
390
0
    };
391
392
0
    return BoundsEqual(CountNode, RHS->getRawCountNode()) &&
393
0
           BoundsEqual(LowerBound, RHS->getRawLowerBound()) &&
394
0
           BoundsEqual(UpperBound, RHS->getRawUpperBound()) &&
395
0
           BoundsEqual(Stride, RHS->getRawStride());
396
0
  }
397
398
275
  unsigned getHashValue() const {
399
275
    if (CountNode)
400
264
      if (auto *MD = dyn_cast<ConstantAsMetadata>(CountNode))
401
138
        return hash_combine(cast<ConstantInt>(MD->getValue())->getSExtValue(),
402
138
                            LowerBound, UpperBound, Stride);
403
137
    return hash_combine(CountNode, LowerBound, UpperBound, Stride);
404
275
  }
405
};
406
407
template <> struct MDNodeKeyImpl<DIGenericSubrange> {
408
  Metadata *CountNode;
409
  Metadata *LowerBound;
410
  Metadata *UpperBound;
411
  Metadata *Stride;
412
413
  MDNodeKeyImpl(Metadata *CountNode, Metadata *LowerBound, Metadata *UpperBound,
414
                Metadata *Stride)
415
      : CountNode(CountNode), LowerBound(LowerBound), UpperBound(UpperBound),
416
0
        Stride(Stride) {}
417
  MDNodeKeyImpl(const DIGenericSubrange *N)
418
      : CountNode(N->getRawCountNode()), LowerBound(N->getRawLowerBound()),
419
0
        UpperBound(N->getRawUpperBound()), Stride(N->getRawStride()) {}
420
421
0
  bool isKeyOf(const DIGenericSubrange *RHS) const {
422
0
    return (CountNode == RHS->getRawCountNode()) &&
423
0
           (LowerBound == RHS->getRawLowerBound()) &&
424
0
           (UpperBound == RHS->getRawUpperBound()) &&
425
0
           (Stride == RHS->getRawStride());
426
0
  }
427
428
0
  unsigned getHashValue() const {
429
0
    auto *MD = dyn_cast_or_null<ConstantAsMetadata>(CountNode);
430
0
    if (CountNode && MD)
431
0
      return hash_combine(cast<ConstantInt>(MD->getValue())->getSExtValue(),
432
0
                          LowerBound, UpperBound, Stride);
433
0
    return hash_combine(CountNode, LowerBound, UpperBound, Stride);
434
0
  }
435
};
436
437
template <> struct MDNodeKeyImpl<DIEnumerator> {
438
  APInt Value;
439
  MDString *Name;
440
  bool IsUnsigned;
441
442
  MDNodeKeyImpl(APInt Value, bool IsUnsigned, MDString *Name)
443
17
      : Value(Value), Name(Name), IsUnsigned(IsUnsigned) {}
444
  MDNodeKeyImpl(int64_t Value, bool IsUnsigned, MDString *Name)
445
      : Value(APInt(64, Value, !IsUnsigned)), Name(Name),
446
0
        IsUnsigned(IsUnsigned) {}
447
  MDNodeKeyImpl(const DIEnumerator *N)
448
      : Value(N->getValue()), Name(N->getRawName()),
449
17
        IsUnsigned(N->isUnsigned()) {}
450
451
0
  bool isKeyOf(const DIEnumerator *RHS) const {
452
0
    return Value.getBitWidth() == RHS->getValue().getBitWidth() &&
453
0
           Value == RHS->getValue() && IsUnsigned == RHS->isUnsigned() &&
454
0
           Name == RHS->getRawName();
455
0
  }
456
457
17
  unsigned getHashValue() const { return hash_combine(Value, Name); }
458
};
459
460
template <> struct MDNodeKeyImpl<DIBasicType> {
461
  unsigned Tag;
462
  MDString *Name;
463
  uint64_t SizeInBits;
464
  uint32_t AlignInBits;
465
  unsigned Encoding;
466
  unsigned Flags;
467
468
  MDNodeKeyImpl(unsigned Tag, MDString *Name, uint64_t SizeInBits,
469
                uint32_t AlignInBits, unsigned Encoding, unsigned Flags)
470
      : Tag(Tag), Name(Name), SizeInBits(SizeInBits), AlignInBits(AlignInBits),
471
6.69k
        Encoding(Encoding), Flags(Flags) {}
472
  MDNodeKeyImpl(const DIBasicType *N)
473
      : Tag(N->getTag()), Name(N->getRawName()), SizeInBits(N->getSizeInBits()),
474
        AlignInBits(N->getAlignInBits()), Encoding(N->getEncoding()),
475
6.69k
        Flags(N->getFlags()) {}
476
477
27
  bool isKeyOf(const DIBasicType *RHS) const {
478
27
    return Tag == RHS->getTag() && Name == RHS->getRawName() &&
479
27
           SizeInBits == RHS->getSizeInBits() &&
480
27
           AlignInBits == RHS->getAlignInBits() &&
481
27
           Encoding == RHS->getEncoding() && Flags == RHS->getFlags();
482
27
  }
483
484
9.45k
  unsigned getHashValue() const {
485
9.45k
    return hash_combine(Tag, Name, SizeInBits, AlignInBits, Encoding);
486
9.45k
  }
487
};
488
489
template <> struct MDNodeKeyImpl<DIStringType> {
490
  unsigned Tag;
491
  MDString *Name;
492
  Metadata *StringLength;
493
  Metadata *StringLengthExp;
494
  Metadata *StringLocationExp;
495
  uint64_t SizeInBits;
496
  uint32_t AlignInBits;
497
  unsigned Encoding;
498
499
  MDNodeKeyImpl(unsigned Tag, MDString *Name, Metadata *StringLength,
500
                Metadata *StringLengthExp, Metadata *StringLocationExp,
501
                uint64_t SizeInBits, uint32_t AlignInBits, unsigned Encoding)
502
      : Tag(Tag), Name(Name), StringLength(StringLength),
503
        StringLengthExp(StringLengthExp), StringLocationExp(StringLocationExp),
504
1
        SizeInBits(SizeInBits), AlignInBits(AlignInBits), Encoding(Encoding) {}
505
  MDNodeKeyImpl(const DIStringType *N)
506
      : Tag(N->getTag()), Name(N->getRawName()),
507
        StringLength(N->getRawStringLength()),
508
        StringLengthExp(N->getRawStringLengthExp()),
509
        StringLocationExp(N->getRawStringLocationExp()),
510
        SizeInBits(N->getSizeInBits()), AlignInBits(N->getAlignInBits()),
511
1
        Encoding(N->getEncoding()) {}
512
513
0
  bool isKeyOf(const DIStringType *RHS) const {
514
0
    return Tag == RHS->getTag() && Name == RHS->getRawName() &&
515
0
           StringLength == RHS->getRawStringLength() &&
516
0
           StringLengthExp == RHS->getRawStringLengthExp() &&
517
0
           StringLocationExp == RHS->getRawStringLocationExp() &&
518
0
           SizeInBits == RHS->getSizeInBits() &&
519
0
           AlignInBits == RHS->getAlignInBits() &&
520
0
           Encoding == RHS->getEncoding();
521
0
  }
522
1
  unsigned getHashValue() const {
523
    // Intentionally computes the hash on a subset of the operands for
524
    // performance reason. The subset has to be significant enough to avoid
525
    // collision "most of the time". There is no correctness issue in case of
526
    // collision because of the full check above.
527
1
    return hash_combine(Tag, Name, StringLength, Encoding);
528
1
  }
529
};
530
531
template <> struct MDNodeKeyImpl<DIDerivedType> {
532
  unsigned Tag;
533
  MDString *Name;
534
  Metadata *File;
535
  unsigned Line;
536
  Metadata *Scope;
537
  Metadata *BaseType;
538
  uint64_t SizeInBits;
539
  uint64_t OffsetInBits;
540
  uint32_t AlignInBits;
541
  std::optional<unsigned> DWARFAddressSpace;
542
  unsigned Flags;
543
  Metadata *ExtraData;
544
  Metadata *Annotations;
545
546
  MDNodeKeyImpl(unsigned Tag, MDString *Name, Metadata *File, unsigned Line,
547
                Metadata *Scope, Metadata *BaseType, uint64_t SizeInBits,
548
                uint32_t AlignInBits, uint64_t OffsetInBits,
549
                std::optional<unsigned> DWARFAddressSpace, unsigned Flags,
550
                Metadata *ExtraData, Metadata *Annotations)
551
      : Tag(Tag), Name(Name), File(File), Line(Line), Scope(Scope),
552
        BaseType(BaseType), SizeInBits(SizeInBits), OffsetInBits(OffsetInBits),
553
        AlignInBits(AlignInBits), DWARFAddressSpace(DWARFAddressSpace),
554
5.05k
        Flags(Flags), ExtraData(ExtraData), Annotations(Annotations) {}
555
  MDNodeKeyImpl(const DIDerivedType *N)
556
      : Tag(N->getTag()), Name(N->getRawName()), File(N->getRawFile()),
557
        Line(N->getLine()), Scope(N->getRawScope()),
558
        BaseType(N->getRawBaseType()), SizeInBits(N->getSizeInBits()),
559
        OffsetInBits(N->getOffsetInBits()), AlignInBits(N->getAlignInBits()),
560
        DWARFAddressSpace(N->getDWARFAddressSpace()), Flags(N->getFlags()),
561
5.22k
        ExtraData(N->getRawExtraData()), Annotations(N->getRawAnnotations()) {}
562
563
97
  bool isKeyOf(const DIDerivedType *RHS) const {
564
97
    return Tag == RHS->getTag() && Name == RHS->getRawName() &&
565
97
           File == RHS->getRawFile() && Line == RHS->getLine() &&
566
97
           Scope == RHS->getRawScope() && BaseType == RHS->getRawBaseType() &&
567
97
           SizeInBits == RHS->getSizeInBits() &&
568
97
           AlignInBits == RHS->getAlignInBits() &&
569
97
           OffsetInBits == RHS->getOffsetInBits() &&
570
97
           DWARFAddressSpace == RHS->getDWARFAddressSpace() &&
571
97
           Flags == RHS->getFlags() && ExtraData == RHS->getRawExtraData() &&
572
97
           Annotations == RHS->getRawAnnotations();
573
97
  }
574
575
8.55k
  unsigned getHashValue() const {
576
    // If this is a member inside an ODR type, only hash the type and the name.
577
    // Otherwise the hash will be stronger than
578
    // MDNodeSubsetEqualImpl::isODRMember().
579
8.55k
    if (Tag == dwarf::DW_TAG_member && Name)
580
2.18k
      if (auto *CT = dyn_cast_or_null<DICompositeType>(Scope))
581
2.16k
        if (CT->getRawIdentifier())
582
224
          return hash_combine(Name, Scope);
583
584
    // Intentionally computes the hash on a subset of the operands for
585
    // performance reason. The subset has to be significant enough to avoid
586
    // collision "most of the time". There is no correctness issue in case of
587
    // collision because of the full check above.
588
8.33k
    return hash_combine(Tag, Name, File, Line, Scope, BaseType, Flags);
589
8.55k
  }
590
};
591
592
template <> struct MDNodeSubsetEqualImpl<DIDerivedType> {
593
  using KeyTy = MDNodeKeyImpl<DIDerivedType>;
594
595
99
  static bool isSubsetEqual(const KeyTy &LHS, const DIDerivedType *RHS) {
596
99
    return isODRMember(LHS.Tag, LHS.Scope, LHS.Name, RHS);
597
99
  }
598
599
  static bool isSubsetEqual(const DIDerivedType *LHS,
600
101
                            const DIDerivedType *RHS) {
601
101
    return isODRMember(LHS->getTag(), LHS->getRawScope(), LHS->getRawName(),
602
101
                       RHS);
603
101
  }
604
605
  /// Subprograms compare equal if they declare the same function in an ODR
606
  /// type.
607
  static bool isODRMember(unsigned Tag, const Metadata *Scope,
608
200
                          const MDString *Name, const DIDerivedType *RHS) {
609
    // Check whether the LHS is eligible.
610
200
    if (Tag != dwarf::DW_TAG_member || !Name)
611
103
      return false;
612
613
97
    auto *CT = dyn_cast_or_null<DICompositeType>(Scope);
614
97
    if (!CT || !CT->getRawIdentifier())
615
89
      return false;
616
617
    // Compare to the RHS.
618
8
    return Tag == RHS->getTag() && Name == RHS->getRawName() &&
619
8
           Scope == RHS->getRawScope();
620
97
  }
621
};
622
623
template <> struct MDNodeKeyImpl<DICompositeType> {
624
  unsigned Tag;
625
  MDString *Name;
626
  Metadata *File;
627
  unsigned Line;
628
  Metadata *Scope;
629
  Metadata *BaseType;
630
  uint64_t SizeInBits;
631
  uint64_t OffsetInBits;
632
  uint32_t AlignInBits;
633
  unsigned Flags;
634
  Metadata *Elements;
635
  unsigned RuntimeLang;
636
  Metadata *VTableHolder;
637
  Metadata *TemplateParams;
638
  MDString *Identifier;
639
  Metadata *Discriminator;
640
  Metadata *DataLocation;
641
  Metadata *Associated;
642
  Metadata *Allocated;
643
  Metadata *Rank;
644
  Metadata *Annotations;
645
646
  MDNodeKeyImpl(unsigned Tag, MDString *Name, Metadata *File, unsigned Line,
647
                Metadata *Scope, Metadata *BaseType, uint64_t SizeInBits,
648
                uint32_t AlignInBits, uint64_t OffsetInBits, unsigned Flags,
649
                Metadata *Elements, unsigned RuntimeLang,
650
                Metadata *VTableHolder, Metadata *TemplateParams,
651
                MDString *Identifier, Metadata *Discriminator,
652
                Metadata *DataLocation, Metadata *Associated,
653
                Metadata *Allocated, Metadata *Rank, Metadata *Annotations)
654
      : Tag(Tag), Name(Name), File(File), Line(Line), Scope(Scope),
655
        BaseType(BaseType), SizeInBits(SizeInBits), OffsetInBits(OffsetInBits),
656
        AlignInBits(AlignInBits), Flags(Flags), Elements(Elements),
657
        RuntimeLang(RuntimeLang), VTableHolder(VTableHolder),
658
        TemplateParams(TemplateParams), Identifier(Identifier),
659
        Discriminator(Discriminator), DataLocation(DataLocation),
660
        Associated(Associated), Allocated(Allocated), Rank(Rank),
661
203
        Annotations(Annotations) {}
662
  MDNodeKeyImpl(const DICompositeType *N)
663
      : Tag(N->getTag()), Name(N->getRawName()), File(N->getRawFile()),
664
        Line(N->getLine()), Scope(N->getRawScope()),
665
        BaseType(N->getRawBaseType()), SizeInBits(N->getSizeInBits()),
666
        OffsetInBits(N->getOffsetInBits()), AlignInBits(N->getAlignInBits()),
667
        Flags(N->getFlags()), Elements(N->getRawElements()),
668
        RuntimeLang(N->getRuntimeLang()), VTableHolder(N->getRawVTableHolder()),
669
        TemplateParams(N->getRawTemplateParams()),
670
        Identifier(N->getRawIdentifier()),
671
        Discriminator(N->getRawDiscriminator()),
672
        DataLocation(N->getRawDataLocation()),
673
        Associated(N->getRawAssociated()), Allocated(N->getRawAllocated()),
674
257
        Rank(N->getRawRank()), Annotations(N->getRawAnnotations()) {}
675
676
0
  bool isKeyOf(const DICompositeType *RHS) const {
677
0
    return Tag == RHS->getTag() && Name == RHS->getRawName() &&
678
0
           File == RHS->getRawFile() && Line == RHS->getLine() &&
679
0
           Scope == RHS->getRawScope() && BaseType == RHS->getRawBaseType() &&
680
0
           SizeInBits == RHS->getSizeInBits() &&
681
0
           AlignInBits == RHS->getAlignInBits() &&
682
0
           OffsetInBits == RHS->getOffsetInBits() && Flags == RHS->getFlags() &&
683
0
           Elements == RHS->getRawElements() &&
684
0
           RuntimeLang == RHS->getRuntimeLang() &&
685
0
           VTableHolder == RHS->getRawVTableHolder() &&
686
0
           TemplateParams == RHS->getRawTemplateParams() &&
687
0
           Identifier == RHS->getRawIdentifier() &&
688
0
           Discriminator == RHS->getRawDiscriminator() &&
689
0
           DataLocation == RHS->getRawDataLocation() &&
690
0
           Associated == RHS->getRawAssociated() &&
691
0
           Allocated == RHS->getRawAllocated() && Rank == RHS->getRawRank() &&
692
0
           Annotations == RHS->getRawAnnotations();
693
0
  }
694
695
257
  unsigned getHashValue() const {
696
    // Intentionally computes the hash on a subset of the operands for
697
    // performance reason. The subset has to be significant enough to avoid
698
    // collision "most of the time". There is no correctness issue in case of
699
    // collision because of the full check above.
700
257
    return hash_combine(Name, File, Line, BaseType, Scope, Elements,
701
257
                        TemplateParams, Annotations);
702
257
  }
703
};
704
705
template <> struct MDNodeKeyImpl<DISubroutineType> {
706
  unsigned Flags;
707
  uint8_t CC;
708
  Metadata *TypeArray;
709
710
  MDNodeKeyImpl(unsigned Flags, uint8_t CC, Metadata *TypeArray)
711
5.01k
      : Flags(Flags), CC(CC), TypeArray(TypeArray) {}
712
  MDNodeKeyImpl(const DISubroutineType *N)
713
5.01k
      : Flags(N->getFlags()), CC(N->getCC()), TypeArray(N->getRawTypeArray()) {}
714
715
2
  bool isKeyOf(const DISubroutineType *RHS) const {
716
2
    return Flags == RHS->getFlags() && CC == RHS->getCC() &&
717
2
           TypeArray == RHS->getRawTypeArray();
718
2
  }
719
720
5.18k
  unsigned getHashValue() const { return hash_combine(Flags, CC, TypeArray); }
721
};
722
723
template <> struct MDNodeKeyImpl<DIFile> {
724
  MDString *Filename;
725
  MDString *Directory;
726
  std::optional<DIFile::ChecksumInfo<MDString *>> Checksum;
727
  MDString *Source;
728
729
  MDNodeKeyImpl(MDString *Filename, MDString *Directory,
730
                std::optional<DIFile::ChecksumInfo<MDString *>> Checksum,
731
                MDString *Source)
732
      : Filename(Filename), Directory(Directory), Checksum(Checksum),
733
5.26k
        Source(Source) {}
734
  MDNodeKeyImpl(const DIFile *N)
735
      : Filename(N->getRawFilename()), Directory(N->getRawDirectory()),
736
5.26k
        Checksum(N->getRawChecksum()), Source(N->getRawSource()) {}
737
738
3
  bool isKeyOf(const DIFile *RHS) const {
739
3
    return Filename == RHS->getRawFilename() &&
740
3
           Directory == RHS->getRawDirectory() &&
741
3
           Checksum == RHS->getRawChecksum() && Source == RHS->getRawSource();
742
3
  }
743
744
5.32k
  unsigned getHashValue() const {
745
5.32k
    return hash_combine(Filename, Directory, Checksum ? Checksum->Kind : 0,
746
5.32k
                        Checksum ? Checksum->Value : nullptr, Source);
747
5.32k
  }
748
};
749
750
template <> struct MDNodeKeyImpl<DISubprogram> {
751
  Metadata *Scope;
752
  MDString *Name;
753
  MDString *LinkageName;
754
  Metadata *File;
755
  unsigned Line;
756
  Metadata *Type;
757
  unsigned ScopeLine;
758
  Metadata *ContainingType;
759
  unsigned VirtualIndex;
760
  int ThisAdjustment;
761
  unsigned Flags;
762
  unsigned SPFlags;
763
  Metadata *Unit;
764
  Metadata *TemplateParams;
765
  Metadata *Declaration;
766
  Metadata *RetainedNodes;
767
  Metadata *ThrownTypes;
768
  Metadata *Annotations;
769
  MDString *TargetFuncName;
770
771
  MDNodeKeyImpl(Metadata *Scope, MDString *Name, MDString *LinkageName,
772
                Metadata *File, unsigned Line, Metadata *Type,
773
                unsigned ScopeLine, Metadata *ContainingType,
774
                unsigned VirtualIndex, int ThisAdjustment, unsigned Flags,
775
                unsigned SPFlags, Metadata *Unit, Metadata *TemplateParams,
776
                Metadata *Declaration, Metadata *RetainedNodes,
777
                Metadata *ThrownTypes, Metadata *Annotations,
778
                MDString *TargetFuncName)
779
      : Scope(Scope), Name(Name), LinkageName(LinkageName), File(File),
780
        Line(Line), Type(Type), ScopeLine(ScopeLine),
781
        ContainingType(ContainingType), VirtualIndex(VirtualIndex),
782
        ThisAdjustment(ThisAdjustment), Flags(Flags), SPFlags(SPFlags),
783
        Unit(Unit), TemplateParams(TemplateParams), Declaration(Declaration),
784
        RetainedNodes(RetainedNodes), ThrownTypes(ThrownTypes),
785
116
        Annotations(Annotations), TargetFuncName(TargetFuncName) {}
786
  MDNodeKeyImpl(const DISubprogram *N)
787
      : Scope(N->getRawScope()), Name(N->getRawName()),
788
        LinkageName(N->getRawLinkageName()), File(N->getRawFile()),
789
        Line(N->getLine()), Type(N->getRawType()), ScopeLine(N->getScopeLine()),
790
        ContainingType(N->getRawContainingType()),
791
        VirtualIndex(N->getVirtualIndex()),
792
        ThisAdjustment(N->getThisAdjustment()), Flags(N->getFlags()),
793
        SPFlags(N->getSPFlags()), Unit(N->getRawUnit()),
794
        TemplateParams(N->getRawTemplateParams()),
795
        Declaration(N->getRawDeclaration()),
796
        RetainedNodes(N->getRawRetainedNodes()),
797
        ThrownTypes(N->getRawThrownTypes()),
798
        Annotations(N->getRawAnnotations()),
799
116
        TargetFuncName(N->getRawTargetFuncName()) {}
800
801
1
  bool isKeyOf(const DISubprogram *RHS) const {
802
1
    return Scope == RHS->getRawScope() && Name == RHS->getRawName() &&
803
1
           LinkageName == RHS->getRawLinkageName() &&
804
1
           File == RHS->getRawFile() && Line == RHS->getLine() &&
805
1
           Type == RHS->getRawType() && ScopeLine == RHS->getScopeLine() &&
806
1
           ContainingType == RHS->getRawContainingType() &&
807
1
           VirtualIndex == RHS->getVirtualIndex() &&
808
1
           ThisAdjustment == RHS->getThisAdjustment() &&
809
1
           Flags == RHS->getFlags() && SPFlags == RHS->getSPFlags() &&
810
1
           Unit == RHS->getUnit() &&
811
1
           TemplateParams == RHS->getRawTemplateParams() &&
812
1
           Declaration == RHS->getRawDeclaration() &&
813
1
           RetainedNodes == RHS->getRawRetainedNodes() &&
814
1
           ThrownTypes == RHS->getRawThrownTypes() &&
815
1
           Annotations == RHS->getRawAnnotations() &&
816
1
           TargetFuncName == RHS->getRawTargetFuncName();
817
1
  }
818
819
148
  bool isDefinition() const { return SPFlags & DISubprogram::SPFlagDefinition; }
820
821
147
  unsigned getHashValue() const {
822
    // If this is a declaration inside an ODR type, only hash the type and the
823
    // name.  Otherwise the hash will be stronger than
824
    // MDNodeSubsetEqualImpl::isDeclarationOfODRMember().
825
147
    if (!isDefinition() && LinkageName)
826
112
      if (auto *CT = dyn_cast_or_null<DICompositeType>(Scope))
827
112
        if (CT->getRawIdentifier())
828
112
          return hash_combine(LinkageName, Scope);
829
830
    // Intentionally computes the hash on a subset of the operands for
831
    // performance reason. The subset has to be significant enough to avoid
832
    // collision "most of the time". There is no correctness issue in case of
833
    // collision because of the full check above.
834
35
    return hash_combine(Name, Scope, File, Type, Line);
835
147
  }
836
};
837
838
template <> struct MDNodeSubsetEqualImpl<DISubprogram> {
839
  using KeyTy = MDNodeKeyImpl<DISubprogram>;
840
841
1
  static bool isSubsetEqual(const KeyTy &LHS, const DISubprogram *RHS) {
842
1
    return isDeclarationOfODRMember(LHS.isDefinition(), LHS.Scope,
843
1
                                    LHS.LinkageName, LHS.TemplateParams, RHS);
844
1
  }
845
846
1
  static bool isSubsetEqual(const DISubprogram *LHS, const DISubprogram *RHS) {
847
1
    return isDeclarationOfODRMember(LHS->isDefinition(), LHS->getRawScope(),
848
1
                                    LHS->getRawLinkageName(),
849
1
                                    LHS->getRawTemplateParams(), RHS);
850
1
  }
851
852
  /// Subprograms compare equal if they declare the same function in an ODR
853
  /// type.
854
  static bool isDeclarationOfODRMember(bool IsDefinition, const Metadata *Scope,
855
                                       const MDString *LinkageName,
856
                                       const Metadata *TemplateParams,
857
2
                                       const DISubprogram *RHS) {
858
    // Check whether the LHS is eligible.
859
2
    if (IsDefinition || !Scope || !LinkageName)
860
0
      return false;
861
862
2
    auto *CT = dyn_cast_or_null<DICompositeType>(Scope);
863
2
    if (!CT || !CT->getRawIdentifier())
864
0
      return false;
865
866
    // Compare to the RHS.
867
    // FIXME: We need to compare template parameters here to avoid incorrect
868
    // collisions in mapMetadata when RF_ReuseAndMutateDistinctMDs and a
869
    // ODR-DISubprogram has a non-ODR template parameter (i.e., a
870
    // DICompositeType that does not have an identifier). Eventually we should
871
    // decouple ODR logic from uniquing logic.
872
2
    return IsDefinition == RHS->isDefinition() && Scope == RHS->getRawScope() &&
873
2
           LinkageName == RHS->getRawLinkageName() &&
874
2
           TemplateParams == RHS->getRawTemplateParams();
875
2
  }
876
};
877
878
template <> struct MDNodeKeyImpl<DILexicalBlock> {
879
  Metadata *Scope;
880
  Metadata *File;
881
  unsigned Line;
882
  unsigned Column;
883
884
  MDNodeKeyImpl(Metadata *Scope, Metadata *File, unsigned Line, unsigned Column)
885
103
      : Scope(Scope), File(File), Line(Line), Column(Column) {}
886
  MDNodeKeyImpl(const DILexicalBlock *N)
887
      : Scope(N->getRawScope()), File(N->getRawFile()), Line(N->getLine()),
888
103
        Column(N->getColumn()) {}
889
890
0
  bool isKeyOf(const DILexicalBlock *RHS) const {
891
0
    return Scope == RHS->getRawScope() && File == RHS->getRawFile() &&
892
0
           Line == RHS->getLine() && Column == RHS->getColumn();
893
0
  }
894
895
103
  unsigned getHashValue() const {
896
103
    return hash_combine(Scope, File, Line, Column);
897
103
  }
898
};
899
900
template <> struct MDNodeKeyImpl<DILexicalBlockFile> {
901
  Metadata *Scope;
902
  Metadata *File;
903
  unsigned Discriminator;
904
905
  MDNodeKeyImpl(Metadata *Scope, Metadata *File, unsigned Discriminator)
906
326
      : Scope(Scope), File(File), Discriminator(Discriminator) {}
907
  MDNodeKeyImpl(const DILexicalBlockFile *N)
908
      : Scope(N->getRawScope()), File(N->getRawFile()),
909
326
        Discriminator(N->getDiscriminator()) {}
910
911
2
  bool isKeyOf(const DILexicalBlockFile *RHS) const {
912
2
    return Scope == RHS->getRawScope() && File == RHS->getRawFile() &&
913
2
           Discriminator == RHS->getDiscriminator();
914
2
  }
915
916
492
  unsigned getHashValue() const {
917
492
    return hash_combine(Scope, File, Discriminator);
918
492
  }
919
};
920
921
template <> struct MDNodeKeyImpl<DINamespace> {
922
  Metadata *Scope;
923
  MDString *Name;
924
  bool ExportSymbols;
925
926
  MDNodeKeyImpl(Metadata *Scope, MDString *Name, bool ExportSymbols)
927
3
      : Scope(Scope), Name(Name), ExportSymbols(ExportSymbols) {}
928
  MDNodeKeyImpl(const DINamespace *N)
929
      : Scope(N->getRawScope()), Name(N->getRawName()),
930
3
        ExportSymbols(N->getExportSymbols()) {}
931
932
0
  bool isKeyOf(const DINamespace *RHS) const {
933
0
    return Scope == RHS->getRawScope() && Name == RHS->getRawName() &&
934
0
           ExportSymbols == RHS->getExportSymbols();
935
0
  }
936
937
3
  unsigned getHashValue() const { return hash_combine(Scope, Name); }
938
};
939
940
template <> struct MDNodeKeyImpl<DICommonBlock> {
941
  Metadata *Scope;
942
  Metadata *Decl;
943
  MDString *Name;
944
  Metadata *File;
945
  unsigned LineNo;
946
947
  MDNodeKeyImpl(Metadata *Scope, Metadata *Decl, MDString *Name, Metadata *File,
948
                unsigned LineNo)
949
0
      : Scope(Scope), Decl(Decl), Name(Name), File(File), LineNo(LineNo) {}
950
  MDNodeKeyImpl(const DICommonBlock *N)
951
      : Scope(N->getRawScope()), Decl(N->getRawDecl()), Name(N->getRawName()),
952
0
        File(N->getRawFile()), LineNo(N->getLineNo()) {}
953
954
0
  bool isKeyOf(const DICommonBlock *RHS) const {
955
0
    return Scope == RHS->getRawScope() && Decl == RHS->getRawDecl() &&
956
0
           Name == RHS->getRawName() && File == RHS->getRawFile() &&
957
0
           LineNo == RHS->getLineNo();
958
0
  }
959
960
0
  unsigned getHashValue() const {
961
0
    return hash_combine(Scope, Decl, Name, File, LineNo);
962
0
  }
963
};
964
965
template <> struct MDNodeKeyImpl<DIModule> {
966
  Metadata *File;
967
  Metadata *Scope;
968
  MDString *Name;
969
  MDString *ConfigurationMacros;
970
  MDString *IncludePath;
971
  MDString *APINotesFile;
972
  unsigned LineNo;
973
  bool IsDecl;
974
975
  MDNodeKeyImpl(Metadata *File, Metadata *Scope, MDString *Name,
976
                MDString *ConfigurationMacros, MDString *IncludePath,
977
                MDString *APINotesFile, unsigned LineNo, bool IsDecl)
978
      : File(File), Scope(Scope), Name(Name),
979
        ConfigurationMacros(ConfigurationMacros), IncludePath(IncludePath),
980
0
        APINotesFile(APINotesFile), LineNo(LineNo), IsDecl(IsDecl) {}
981
  MDNodeKeyImpl(const DIModule *N)
982
      : File(N->getRawFile()), Scope(N->getRawScope()), Name(N->getRawName()),
983
        ConfigurationMacros(N->getRawConfigurationMacros()),
984
        IncludePath(N->getRawIncludePath()),
985
        APINotesFile(N->getRawAPINotesFile()), LineNo(N->getLineNo()),
986
0
        IsDecl(N->getIsDecl()) {}
987
988
0
  bool isKeyOf(const DIModule *RHS) const {
989
0
    return Scope == RHS->getRawScope() && Name == RHS->getRawName() &&
990
0
           ConfigurationMacros == RHS->getRawConfigurationMacros() &&
991
0
           IncludePath == RHS->getRawIncludePath() &&
992
0
           APINotesFile == RHS->getRawAPINotesFile() &&
993
0
           File == RHS->getRawFile() && LineNo == RHS->getLineNo() &&
994
0
           IsDecl == RHS->getIsDecl();
995
0
  }
996
997
0
  unsigned getHashValue() const {
998
0
    return hash_combine(Scope, Name, ConfigurationMacros, IncludePath);
999
0
  }
1000
};
1001
1002
template <> struct MDNodeKeyImpl<DITemplateTypeParameter> {
1003
  MDString *Name;
1004
  Metadata *Type;
1005
  bool IsDefault;
1006
1007
  MDNodeKeyImpl(MDString *Name, Metadata *Type, bool IsDefault)
1008
27
      : Name(Name), Type(Type), IsDefault(IsDefault) {}
1009
  MDNodeKeyImpl(const DITemplateTypeParameter *N)
1010
      : Name(N->getRawName()), Type(N->getRawType()),
1011
31
        IsDefault(N->isDefault()) {}
1012
1013
0
  bool isKeyOf(const DITemplateTypeParameter *RHS) const {
1014
0
    return Name == RHS->getRawName() && Type == RHS->getRawType() &&
1015
0
           IsDefault == RHS->isDefault();
1016
0
  }
1017
1018
31
  unsigned getHashValue() const { return hash_combine(Name, Type, IsDefault); }
1019
};
1020
1021
template <> struct MDNodeKeyImpl<DITemplateValueParameter> {
1022
  unsigned Tag;
1023
  MDString *Name;
1024
  Metadata *Type;
1025
  bool IsDefault;
1026
  Metadata *Value;
1027
1028
  MDNodeKeyImpl(unsigned Tag, MDString *Name, Metadata *Type, bool IsDefault,
1029
                Metadata *Value)
1030
0
      : Tag(Tag), Name(Name), Type(Type), IsDefault(IsDefault), Value(Value) {}
1031
  MDNodeKeyImpl(const DITemplateValueParameter *N)
1032
      : Tag(N->getTag()), Name(N->getRawName()), Type(N->getRawType()),
1033
0
        IsDefault(N->isDefault()), Value(N->getValue()) {}
1034
1035
0
  bool isKeyOf(const DITemplateValueParameter *RHS) const {
1036
0
    return Tag == RHS->getTag() && Name == RHS->getRawName() &&
1037
0
           Type == RHS->getRawType() && IsDefault == RHS->isDefault() &&
1038
0
           Value == RHS->getValue();
1039
0
  }
1040
1041
0
  unsigned getHashValue() const {
1042
0
    return hash_combine(Tag, Name, Type, IsDefault, Value);
1043
0
  }
1044
};
1045
1046
template <> struct MDNodeKeyImpl<DIGlobalVariable> {
1047
  Metadata *Scope;
1048
  MDString *Name;
1049
  MDString *LinkageName;
1050
  Metadata *File;
1051
  unsigned Line;
1052
  Metadata *Type;
1053
  bool IsLocalToUnit;
1054
  bool IsDefinition;
1055
  Metadata *StaticDataMemberDeclaration;
1056
  Metadata *TemplateParams;
1057
  uint32_t AlignInBits;
1058
  Metadata *Annotations;
1059
1060
  MDNodeKeyImpl(Metadata *Scope, MDString *Name, MDString *LinkageName,
1061
                Metadata *File, unsigned Line, Metadata *Type,
1062
                bool IsLocalToUnit, bool IsDefinition,
1063
                Metadata *StaticDataMemberDeclaration, Metadata *TemplateParams,
1064
                uint32_t AlignInBits, Metadata *Annotations)
1065
      : Scope(Scope), Name(Name), LinkageName(LinkageName), File(File),
1066
        Line(Line), Type(Type), IsLocalToUnit(IsLocalToUnit),
1067
        IsDefinition(IsDefinition),
1068
        StaticDataMemberDeclaration(StaticDataMemberDeclaration),
1069
        TemplateParams(TemplateParams), AlignInBits(AlignInBits),
1070
493
        Annotations(Annotations) {}
1071
  MDNodeKeyImpl(const DIGlobalVariable *N)
1072
      : Scope(N->getRawScope()), Name(N->getRawName()),
1073
        LinkageName(N->getRawLinkageName()), File(N->getRawFile()),
1074
        Line(N->getLine()), Type(N->getRawType()),
1075
        IsLocalToUnit(N->isLocalToUnit()), IsDefinition(N->isDefinition()),
1076
        StaticDataMemberDeclaration(N->getRawStaticDataMemberDeclaration()),
1077
        TemplateParams(N->getRawTemplateParams()),
1078
610
        AlignInBits(N->getAlignInBits()), Annotations(N->getRawAnnotations()) {}
1079
1080
8
  bool isKeyOf(const DIGlobalVariable *RHS) const {
1081
8
    return Scope == RHS->getRawScope() && Name == RHS->getRawName() &&
1082
8
           LinkageName == RHS->getRawLinkageName() &&
1083
8
           File == RHS->getRawFile() && Line == RHS->getLine() &&
1084
8
           Type == RHS->getRawType() && IsLocalToUnit == RHS->isLocalToUnit() &&
1085
8
           IsDefinition == RHS->isDefinition() &&
1086
8
           StaticDataMemberDeclaration ==
1087
0
               RHS->getRawStaticDataMemberDeclaration() &&
1088
8
           TemplateParams == RHS->getRawTemplateParams() &&
1089
8
           AlignInBits == RHS->getAlignInBits() &&
1090
8
           Annotations == RHS->getRawAnnotations();
1091
8
  }
1092
1093
932
  unsigned getHashValue() const {
1094
    // We do not use AlignInBits in hashing function here on purpose:
1095
    // in most cases this param for local variable is zero (for function param
1096
    // it is always zero). This leads to lots of hash collisions and errors on
1097
    // cases with lots of similar variables.
1098
    // clang/test/CodeGen/debug-info-257-args.c is an example of this problem,
1099
    // generated IR is random for each run and test fails with Align included.
1100
    // TODO: make hashing work fine with such situations
1101
932
    return hash_combine(Scope, Name, LinkageName, File, Line, Type,
1102
932
                        IsLocalToUnit, IsDefinition, /* AlignInBits, */
1103
932
                        StaticDataMemberDeclaration, Annotations);
1104
932
  }
1105
};
1106
1107
template <> struct MDNodeKeyImpl<DILocalVariable> {
1108
  Metadata *Scope;
1109
  MDString *Name;
1110
  Metadata *File;
1111
  unsigned Line;
1112
  Metadata *Type;
1113
  unsigned Arg;
1114
  unsigned Flags;
1115
  uint32_t AlignInBits;
1116
  Metadata *Annotations;
1117
1118
  MDNodeKeyImpl(Metadata *Scope, MDString *Name, Metadata *File, unsigned Line,
1119
                Metadata *Type, unsigned Arg, unsigned Flags,
1120
                uint32_t AlignInBits, Metadata *Annotations)
1121
      : Scope(Scope), Name(Name), File(File), Line(Line), Type(Type), Arg(Arg),
1122
11.4k
        Flags(Flags), AlignInBits(AlignInBits), Annotations(Annotations) {}
1123
  MDNodeKeyImpl(const DILocalVariable *N)
1124
      : Scope(N->getRawScope()), Name(N->getRawName()), File(N->getRawFile()),
1125
        Line(N->getLine()), Type(N->getRawType()), Arg(N->getArg()),
1126
        Flags(N->getFlags()), AlignInBits(N->getAlignInBits()),
1127
11.4k
        Annotations(N->getRawAnnotations()) {}
1128
1129
243
  bool isKeyOf(const DILocalVariable *RHS) const {
1130
243
    return Scope == RHS->getRawScope() && Name == RHS->getRawName() &&
1131
243
           File == RHS->getRawFile() && Line == RHS->getLine() &&
1132
243
           Type == RHS->getRawType() && Arg == RHS->getArg() &&
1133
243
           Flags == RHS->getFlags() && AlignInBits == RHS->getAlignInBits() &&
1134
243
           Annotations == RHS->getRawAnnotations();
1135
243
  }
1136
1137
19.0k
  unsigned getHashValue() const {
1138
    // We do not use AlignInBits in hashing function here on purpose:
1139
    // in most cases this param for local variable is zero (for function param
1140
    // it is always zero). This leads to lots of hash collisions and errors on
1141
    // cases with lots of similar variables.
1142
    // clang/test/CodeGen/debug-info-257-args.c is an example of this problem,
1143
    // generated IR is random for each run and test fails with Align included.
1144
    // TODO: make hashing work fine with such situations
1145
19.0k
    return hash_combine(Scope, Name, File, Line, Type, Arg, Flags, Annotations);
1146
19.0k
  }
1147
};
1148
1149
template <> struct MDNodeKeyImpl<DILabel> {
1150
  Metadata *Scope;
1151
  MDString *Name;
1152
  Metadata *File;
1153
  unsigned Line;
1154
1155
  MDNodeKeyImpl(Metadata *Scope, MDString *Name, Metadata *File, unsigned Line)
1156
0
      : Scope(Scope), Name(Name), File(File), Line(Line) {}
1157
  MDNodeKeyImpl(const DILabel *N)
1158
      : Scope(N->getRawScope()), Name(N->getRawName()), File(N->getRawFile()),
1159
0
        Line(N->getLine()) {}
1160
1161
0
  bool isKeyOf(const DILabel *RHS) const {
1162
0
    return Scope == RHS->getRawScope() && Name == RHS->getRawName() &&
1163
0
           File == RHS->getRawFile() && Line == RHS->getLine();
1164
0
  }
1165
1166
  /// Using name and line to get hash value. It should already be mostly unique.
1167
0
  unsigned getHashValue() const { return hash_combine(Scope, Name, Line); }
1168
};
1169
1170
template <> struct MDNodeKeyImpl<DIExpression> {
1171
  ArrayRef<uint64_t> Elements;
1172
1173
41.0k
  MDNodeKeyImpl(ArrayRef<uint64_t> Elements) : Elements(Elements) {}
1174
40.8k
  MDNodeKeyImpl(const DIExpression *N) : Elements(N->getElements()) {}
1175
1176
30.3k
  bool isKeyOf(const DIExpression *RHS) const {
1177
30.3k
    return Elements == RHS->getElements();
1178
30.3k
  }
1179
1180
78.2k
  unsigned getHashValue() const {
1181
78.2k
    return hash_combine_range(Elements.begin(), Elements.end());
1182
78.2k
  }
1183
};
1184
1185
template <> struct MDNodeKeyImpl<DIGlobalVariableExpression> {
1186
  Metadata *Variable;
1187
  Metadata *Expression;
1188
1189
  MDNodeKeyImpl(Metadata *Variable, Metadata *Expression)
1190
557
      : Variable(Variable), Expression(Expression) {}
1191
  MDNodeKeyImpl(const DIGlobalVariableExpression *N)
1192
557
      : Variable(N->getRawVariable()), Expression(N->getRawExpression()) {}
1193
1194
10
  bool isKeyOf(const DIGlobalVariableExpression *RHS) const {
1195
10
    return Variable == RHS->getRawVariable() &&
1196
10
           Expression == RHS->getRawExpression();
1197
10
  }
1198
1199
896
  unsigned getHashValue() const { return hash_combine(Variable, Expression); }
1200
};
1201
1202
template <> struct MDNodeKeyImpl<DIObjCProperty> {
1203
  MDString *Name;
1204
  Metadata *File;
1205
  unsigned Line;
1206
  MDString *GetterName;
1207
  MDString *SetterName;
1208
  unsigned Attributes;
1209
  Metadata *Type;
1210
1211
  MDNodeKeyImpl(MDString *Name, Metadata *File, unsigned Line,
1212
                MDString *GetterName, MDString *SetterName, unsigned Attributes,
1213
                Metadata *Type)
1214
      : Name(Name), File(File), Line(Line), GetterName(GetterName),
1215
0
        SetterName(SetterName), Attributes(Attributes), Type(Type) {}
1216
  MDNodeKeyImpl(const DIObjCProperty *N)
1217
      : Name(N->getRawName()), File(N->getRawFile()), Line(N->getLine()),
1218
        GetterName(N->getRawGetterName()), SetterName(N->getRawSetterName()),
1219
0
        Attributes(N->getAttributes()), Type(N->getRawType()) {}
1220
1221
0
  bool isKeyOf(const DIObjCProperty *RHS) const {
1222
0
    return Name == RHS->getRawName() && File == RHS->getRawFile() &&
1223
0
           Line == RHS->getLine() && GetterName == RHS->getRawGetterName() &&
1224
0
           SetterName == RHS->getRawSetterName() &&
1225
0
           Attributes == RHS->getAttributes() && Type == RHS->getRawType();
1226
0
  }
1227
1228
0
  unsigned getHashValue() const {
1229
0
    return hash_combine(Name, File, Line, GetterName, SetterName, Attributes,
1230
0
                        Type);
1231
0
  }
1232
};
1233
1234
template <> struct MDNodeKeyImpl<DIImportedEntity> {
1235
  unsigned Tag;
1236
  Metadata *Scope;
1237
  Metadata *Entity;
1238
  Metadata *File;
1239
  unsigned Line;
1240
  MDString *Name;
1241
  Metadata *Elements;
1242
1243
  MDNodeKeyImpl(unsigned Tag, Metadata *Scope, Metadata *Entity, Metadata *File,
1244
                unsigned Line, MDString *Name, Metadata *Elements)
1245
      : Tag(Tag), Scope(Scope), Entity(Entity), File(File), Line(Line),
1246
0
        Name(Name), Elements(Elements) {}
1247
  MDNodeKeyImpl(const DIImportedEntity *N)
1248
      : Tag(N->getTag()), Scope(N->getRawScope()), Entity(N->getRawEntity()),
1249
        File(N->getRawFile()), Line(N->getLine()), Name(N->getRawName()),
1250
0
        Elements(N->getRawElements()) {}
1251
1252
0
  bool isKeyOf(const DIImportedEntity *RHS) const {
1253
0
    return Tag == RHS->getTag() && Scope == RHS->getRawScope() &&
1254
0
           Entity == RHS->getRawEntity() && File == RHS->getFile() &&
1255
0
           Line == RHS->getLine() && Name == RHS->getRawName() &&
1256
0
           Elements == RHS->getRawElements();
1257
0
  }
1258
1259
0
  unsigned getHashValue() const {
1260
0
    return hash_combine(Tag, Scope, Entity, File, Line, Name, Elements);
1261
0
  }
1262
};
1263
1264
template <> struct MDNodeKeyImpl<DIMacro> {
1265
  unsigned MIType;
1266
  unsigned Line;
1267
  MDString *Name;
1268
  MDString *Value;
1269
1270
  MDNodeKeyImpl(unsigned MIType, unsigned Line, MDString *Name, MDString *Value)
1271
0
      : MIType(MIType), Line(Line), Name(Name), Value(Value) {}
1272
  MDNodeKeyImpl(const DIMacro *N)
1273
      : MIType(N->getMacinfoType()), Line(N->getLine()), Name(N->getRawName()),
1274
0
        Value(N->getRawValue()) {}
1275
1276
0
  bool isKeyOf(const DIMacro *RHS) const {
1277
0
    return MIType == RHS->getMacinfoType() && Line == RHS->getLine() &&
1278
0
           Name == RHS->getRawName() && Value == RHS->getRawValue();
1279
0
  }
1280
1281
0
  unsigned getHashValue() const {
1282
0
    return hash_combine(MIType, Line, Name, Value);
1283
0
  }
1284
};
1285
1286
template <> struct MDNodeKeyImpl<DIMacroFile> {
1287
  unsigned MIType;
1288
  unsigned Line;
1289
  Metadata *File;
1290
  Metadata *Elements;
1291
1292
  MDNodeKeyImpl(unsigned MIType, unsigned Line, Metadata *File,
1293
                Metadata *Elements)
1294
0
      : MIType(MIType), Line(Line), File(File), Elements(Elements) {}
1295
  MDNodeKeyImpl(const DIMacroFile *N)
1296
      : MIType(N->getMacinfoType()), Line(N->getLine()), File(N->getRawFile()),
1297
0
        Elements(N->getRawElements()) {}
1298
1299
0
  bool isKeyOf(const DIMacroFile *RHS) const {
1300
0
    return MIType == RHS->getMacinfoType() && Line == RHS->getLine() &&
1301
0
           File == RHS->getRawFile() && Elements == RHS->getRawElements();
1302
0
  }
1303
1304
0
  unsigned getHashValue() const {
1305
0
    return hash_combine(MIType, Line, File, Elements);
1306
0
  }
1307
};
1308
1309
// DIArgLists are not MDNodes, but we still want to unique them in a DenseSet
1310
// based on a hash of their arguments.
1311
struct DIArgListKeyInfo {
1312
  ArrayRef<ValueAsMetadata *> Args;
1313
1314
36.4k
  DIArgListKeyInfo(ArrayRef<ValueAsMetadata *> Args) : Args(Args) {}
1315
615k
  DIArgListKeyInfo(const DIArgList *N) : Args(N->getArgs()) {}
1316
1317
250k
  bool isKeyOf(const DIArgList *RHS) const { return Args == RHS->getArgs(); }
1318
1319
650k
  unsigned getHashValue() const {
1320
650k
    return hash_combine_range(Args.begin(), Args.end());
1321
650k
  }
1322
};
1323
1324
/// DenseMapInfo for DIArgList.
1325
struct DIArgListInfo {
1326
  using KeyTy = DIArgListKeyInfo;
1327
1328
1.90M
  static inline DIArgList *getEmptyKey() {
1329
1.90M
    return DenseMapInfo<DIArgList *>::getEmptyKey();
1330
1.90M
  }
1331
1332
1.49M
  static inline DIArgList *getTombstoneKey() {
1333
1.49M
    return DenseMapInfo<DIArgList *>::getTombstoneKey();
1334
1.49M
  }
1335
1336
209k
  static unsigned getHashValue(const KeyTy &Key) { return Key.getHashValue(); }
1337
1338
441k
  static unsigned getHashValue(const DIArgList *N) {
1339
441k
    return KeyTy(N).getHashValue();
1340
441k
  }
1341
1342
1.04M
  static bool isEqual(const KeyTy &LHS, const DIArgList *RHS) {
1343
1.04M
    if (RHS == getEmptyKey() || RHS == getTombstoneKey())
1344
793k
      return false;
1345
250k
    return LHS.isKeyOf(RHS);
1346
1.04M
  }
1347
1348
5.01M
  static bool isEqual(const DIArgList *LHS, const DIArgList *RHS) {
1349
5.01M
    return LHS == RHS;
1350
5.01M
  }
1351
};
1352
1353
/// DenseMapInfo for MDNode subclasses.
1354
template <class NodeTy> struct MDNodeInfo {
1355
  using KeyTy = MDNodeKeyImpl<NodeTy>;
1356
  using SubsetEqualTy = MDNodeSubsetEqualImpl<NodeTy>;
1357
1358
14.2M
  static inline NodeTy *getEmptyKey() {
1359
14.2M
    return DenseMapInfo<NodeTy *>::getEmptyKey();
1360
14.2M
  }
llvm::MDNodeInfo<llvm::DILocation>::getEmptyKey()
Line
Count
Source
1358
467k
  static inline NodeTy *getEmptyKey() {
1359
467k
    return DenseMapInfo<NodeTy *>::getEmptyKey();
1360
467k
  }
llvm::MDNodeInfo<llvm::GenericDINode>::getEmptyKey()
Line
Count
Source
1358
289
  static inline NodeTy *getEmptyKey() {
1359
289
    return DenseMapInfo<NodeTy *>::getEmptyKey();
1360
289
  }
llvm::MDNodeInfo<llvm::DISubrange>::getEmptyKey()
Line
Count
Source
1358
4.67k
  static inline NodeTy *getEmptyKey() {
1359
4.67k
    return DenseMapInfo<NodeTy *>::getEmptyKey();
1360
4.67k
  }
Unexecuted instantiation: llvm::MDNodeInfo<llvm::DIGenericSubrange>::getEmptyKey()
llvm::MDNodeInfo<llvm::DIEnumerator>::getEmptyKey()
Line
Count
Source
1358
289
  static inline NodeTy *getEmptyKey() {
1359
289
    return DenseMapInfo<NodeTy *>::getEmptyKey();
1360
289
  }
llvm::MDNodeInfo<llvm::DIBasicType>::getEmptyKey()
Line
Count
Source
1358
113k
  static inline NodeTy *getEmptyKey() {
1359
113k
    return DenseMapInfo<NodeTy *>::getEmptyKey();
1360
113k
  }
llvm::MDNodeInfo<llvm::DIStringType>::getEmptyKey()
Line
Count
Source
1358
17
  static inline NodeTy *getEmptyKey() {
1359
17
    return DenseMapInfo<NodeTy *>::getEmptyKey();
1360
17
  }
llvm::MDNodeInfo<llvm::DIDerivedType>::getEmptyKey()
Line
Count
Source
1358
87.3k
  static inline NodeTy *getEmptyKey() {
1359
87.3k
    return DenseMapInfo<NodeTy *>::getEmptyKey();
1360
87.3k
  }
llvm::MDNodeInfo<llvm::DICompositeType>::getEmptyKey()
Line
Count
Source
1358
3.72k
  static inline NodeTy *getEmptyKey() {
1359
3.72k
    return DenseMapInfo<NodeTy *>::getEmptyKey();
1360
3.72k
  }
llvm::MDNodeInfo<llvm::DISubroutineType>::getEmptyKey()
Line
Count
Source
1358
85.2k
  static inline NodeTy *getEmptyKey() {
1359
85.2k
    return DenseMapInfo<NodeTy *>::getEmptyKey();
1360
85.2k
  }
llvm::MDNodeInfo<llvm::DIFile>::getEmptyKey()
Line
Count
Source
1358
89.4k
  static inline NodeTy *getEmptyKey() {
1359
89.4k
    return DenseMapInfo<NodeTy *>::getEmptyKey();
1360
89.4k
  }
llvm::MDNodeInfo<llvm::DISubprogram>::getEmptyKey()
Line
Count
Source
1358
1.97k
  static inline NodeTy *getEmptyKey() {
1359
1.97k
    return DenseMapInfo<NodeTy *>::getEmptyKey();
1360
1.97k
  }
llvm::MDNodeInfo<llvm::DILexicalBlock>::getEmptyKey()
Line
Count
Source
1358
1.75k
  static inline NodeTy *getEmptyKey() {
1359
1.75k
    return DenseMapInfo<NodeTy *>::getEmptyKey();
1360
1.75k
  }
llvm::MDNodeInfo<llvm::DILexicalBlockFile>::getEmptyKey()
Line
Count
Source
1358
5.55k
  static inline NodeTy *getEmptyKey() {
1359
5.55k
    return DenseMapInfo<NodeTy *>::getEmptyKey();
1360
5.55k
  }
llvm::MDNodeInfo<llvm::DINamespace>::getEmptyKey()
Line
Count
Source
1358
51
  static inline NodeTy *getEmptyKey() {
1359
51
    return DenseMapInfo<NodeTy *>::getEmptyKey();
1360
51
  }
Unexecuted instantiation: llvm::MDNodeInfo<llvm::DICommonBlock>::getEmptyKey()
Unexecuted instantiation: llvm::MDNodeInfo<llvm::DIModule>::getEmptyKey()
llvm::MDNodeInfo<llvm::DITemplateTypeParameter>::getEmptyKey()
Line
Count
Source
1358
435
  static inline NodeTy *getEmptyKey() {
1359
435
    return DenseMapInfo<NodeTy *>::getEmptyKey();
1360
435
  }
Unexecuted instantiation: llvm::MDNodeInfo<llvm::DITemplateValueParameter>::getEmptyKey()
llvm::MDNodeInfo<llvm::DIGlobalVariable>::getEmptyKey()
Line
Count
Source
1358
9.01k
  static inline NodeTy *getEmptyKey() {
1359
9.01k
    return DenseMapInfo<NodeTy *>::getEmptyKey();
1360
9.01k
  }
llvm::MDNodeInfo<llvm::DILocalVariable>::getEmptyKey()
Line
Count
Source
1358
195k
  static inline NodeTy *getEmptyKey() {
1359
195k
    return DenseMapInfo<NodeTy *>::getEmptyKey();
1360
195k
  }
Unexecuted instantiation: llvm::MDNodeInfo<llvm::DILabel>::getEmptyKey()
llvm::MDNodeInfo<llvm::DIExpression>::getEmptyKey()
Line
Count
Source
1358
750k
  static inline NodeTy *getEmptyKey() {
1359
750k
    return DenseMapInfo<NodeTy *>::getEmptyKey();
1360
750k
  }
llvm::MDNodeInfo<llvm::DIGlobalVariableExpression>::getEmptyKey()
Line
Count
Source
1358
9.52k
  static inline NodeTy *getEmptyKey() {
1359
9.52k
    return DenseMapInfo<NodeTy *>::getEmptyKey();
1360
9.52k
  }
Unexecuted instantiation: llvm::MDNodeInfo<llvm::DIObjCProperty>::getEmptyKey()
Unexecuted instantiation: llvm::MDNodeInfo<llvm::DIImportedEntity>::getEmptyKey()
Unexecuted instantiation: llvm::MDNodeInfo<llvm::DIMacro>::getEmptyKey()
Unexecuted instantiation: llvm::MDNodeInfo<llvm::DIMacroFile>::getEmptyKey()
llvm::MDNodeInfo<llvm::MDTuple>::getEmptyKey()
Line
Count
Source
1358
12.4M
  static inline NodeTy *getEmptyKey() {
1359
12.4M
    return DenseMapInfo<NodeTy *>::getEmptyKey();
1360
12.4M
  }
1361
1362
7.84M
  static inline NodeTy *getTombstoneKey() {
1363
7.84M
    return DenseMapInfo<NodeTy *>::getTombstoneKey();
1364
7.84M
  }
llvm::MDNodeInfo<llvm::DILocation>::getTombstoneKey()
Line
Count
Source
1362
260k
  static inline NodeTy *getTombstoneKey() {
1363
260k
    return DenseMapInfo<NodeTy *>::getTombstoneKey();
1364
260k
  }
llvm::MDNodeInfo<llvm::GenericDINode>::getTombstoneKey()
Line
Count
Source
1362
170
  static inline NodeTy *getTombstoneKey() {
1363
170
    return DenseMapInfo<NodeTy *>::getTombstoneKey();
1364
170
  }
llvm::MDNodeInfo<llvm::DISubrange>::getTombstoneKey()
Line
Count
Source
1362
2.75k
  static inline NodeTy *getTombstoneKey() {
1363
2.75k
    return DenseMapInfo<NodeTy *>::getTombstoneKey();
1364
2.75k
  }
Unexecuted instantiation: llvm::MDNodeInfo<llvm::DIGenericSubrange>::getTombstoneKey()
llvm::MDNodeInfo<llvm::DIEnumerator>::getTombstoneKey()
Line
Count
Source
1362
170
  static inline NodeTy *getTombstoneKey() {
1363
170
    return DenseMapInfo<NodeTy *>::getTombstoneKey();
1364
170
  }
llvm::MDNodeInfo<llvm::DIBasicType>::getTombstoneKey()
Line
Count
Source
1362
64.3k
  static inline NodeTy *getTombstoneKey() {
1363
64.3k
    return DenseMapInfo<NodeTy *>::getTombstoneKey();
1364
64.3k
  }
llvm::MDNodeInfo<llvm::DIStringType>::getTombstoneKey()
Line
Count
Source
1362
10
  static inline NodeTy *getTombstoneKey() {
1363
10
    return DenseMapInfo<NodeTy *>::getTombstoneKey();
1364
10
  }
llvm::MDNodeInfo<llvm::DIDerivedType>::getTombstoneKey()
Line
Count
Source
1362
48.0k
  static inline NodeTy *getTombstoneKey() {
1363
48.0k
    return DenseMapInfo<NodeTy *>::getTombstoneKey();
1364
48.0k
  }
llvm::MDNodeInfo<llvm::DICompositeType>::getTombstoneKey()
Line
Count
Source
1362
2.15k
  static inline NodeTy *getTombstoneKey() {
1363
2.15k
    return DenseMapInfo<NodeTy *>::getTombstoneKey();
1364
2.15k
  }
llvm::MDNodeInfo<llvm::DISubroutineType>::getTombstoneKey()
Line
Count
Source
1362
49.9k
  static inline NodeTy *getTombstoneKey() {
1363
49.9k
    return DenseMapInfo<NodeTy *>::getTombstoneKey();
1364
49.9k
  }
llvm::MDNodeInfo<llvm::DIFile>::getTombstoneKey()
Line
Count
Source
1362
52.5k
  static inline NodeTy *getTombstoneKey() {
1363
52.5k
    return DenseMapInfo<NodeTy *>::getTombstoneKey();
1364
52.5k
  }
llvm::MDNodeInfo<llvm::DISubprogram>::getTombstoneKey()
Line
Count
Source
1362
1.13k
  static inline NodeTy *getTombstoneKey() {
1363
1.13k
    return DenseMapInfo<NodeTy *>::getTombstoneKey();
1364
1.13k
  }
llvm::MDNodeInfo<llvm::DILexicalBlock>::getTombstoneKey()
Line
Count
Source
1362
1.03k
  static inline NodeTy *getTombstoneKey() {
1363
1.03k
    return DenseMapInfo<NodeTy *>::getTombstoneKey();
1364
1.03k
  }
llvm::MDNodeInfo<llvm::DILexicalBlockFile>::getTombstoneKey()
Line
Count
Source
1362
3.10k
  static inline NodeTy *getTombstoneKey() {
1363
3.10k
    return DenseMapInfo<NodeTy *>::getTombstoneKey();
1364
3.10k
  }
llvm::MDNodeInfo<llvm::DINamespace>::getTombstoneKey()
Line
Count
Source
1362
30
  static inline NodeTy *getTombstoneKey() {
1363
30
    return DenseMapInfo<NodeTy *>::getTombstoneKey();
1364
30
  }
Unexecuted instantiation: llvm::MDNodeInfo<llvm::DICommonBlock>::getTombstoneKey()
Unexecuted instantiation: llvm::MDNodeInfo<llvm::DIModule>::getTombstoneKey()
llvm::MDNodeInfo<llvm::DITemplateTypeParameter>::getTombstoneKey()
Line
Count
Source
1362
254
  static inline NodeTy *getTombstoneKey() {
1363
254
    return DenseMapInfo<NodeTy *>::getTombstoneKey();
1364
254
  }
Unexecuted instantiation: llvm::MDNodeInfo<llvm::DITemplateValueParameter>::getTombstoneKey()
llvm::MDNodeInfo<llvm::DIGlobalVariable>::getTombstoneKey()
Line
Count
Source
1362
4.91k
  static inline NodeTy *getTombstoneKey() {
1363
4.91k
    return DenseMapInfo<NodeTy *>::getTombstoneKey();
1364
4.91k
  }
llvm::MDNodeInfo<llvm::DILocalVariable>::getTombstoneKey()
Line
Count
Source
1362
107k
  static inline NodeTy *getTombstoneKey() {
1363
107k
    return DenseMapInfo<NodeTy *>::getTombstoneKey();
1364
107k
  }
Unexecuted instantiation: llvm::MDNodeInfo<llvm::DILabel>::getTombstoneKey()
llvm::MDNodeInfo<llvm::DIExpression>::getTombstoneKey()
Line
Count
Source
1362
424k
  static inline NodeTy *getTombstoneKey() {
1363
424k
    return DenseMapInfo<NodeTy *>::getTombstoneKey();
1364
424k
  }
llvm::MDNodeInfo<llvm::DIGlobalVariableExpression>::getTombstoneKey()
Line
Count
Source
1362
5.27k
  static inline NodeTy *getTombstoneKey() {
1363
5.27k
    return DenseMapInfo<NodeTy *>::getTombstoneKey();
1364
5.27k
  }
Unexecuted instantiation: llvm::MDNodeInfo<llvm::DIObjCProperty>::getTombstoneKey()
Unexecuted instantiation: llvm::MDNodeInfo<llvm::DIImportedEntity>::getTombstoneKey()
Unexecuted instantiation: llvm::MDNodeInfo<llvm::DIMacro>::getTombstoneKey()
Unexecuted instantiation: llvm::MDNodeInfo<llvm::DIMacroFile>::getTombstoneKey()
llvm::MDNodeInfo<llvm::MDTuple>::getTombstoneKey()
Line
Count
Source
1362
6.81M
  static inline NodeTy *getTombstoneKey() {
1363
6.81M
    return DenseMapInfo<NodeTy *>::getTombstoneKey();
1364
6.81M
  }
1365
1366
641k
  static unsigned getHashValue(const KeyTy &Key) { return Key.getHashValue(); }
llvm::MDNodeInfo<llvm::DILocation>::getHashValue(llvm::MDNodeKeyImpl<llvm::DILocation> const&)
Line
Count
Source
1366
26.4k
  static unsigned getHashValue(const KeyTy &Key) { return Key.getHashValue(); }
Unexecuted instantiation: llvm::MDNodeInfo<llvm::GenericDINode>::getHashValue(llvm::MDNodeKeyImpl<llvm::GenericDINode> const&)
Unexecuted instantiation: llvm::MDNodeInfo<llvm::DISubrange>::getHashValue(llvm::MDNodeKeyImpl<llvm::DISubrange> const&)
Unexecuted instantiation: llvm::MDNodeInfo<llvm::DIGenericSubrange>::getHashValue(llvm::MDNodeKeyImpl<llvm::DIGenericSubrange> const&)
Unexecuted instantiation: llvm::MDNodeInfo<llvm::DIEnumerator>::getHashValue(llvm::MDNodeKeyImpl<llvm::DIEnumerator> const&)
llvm::MDNodeInfo<llvm::DIBasicType>::getHashValue(llvm::MDNodeKeyImpl<llvm::DIBasicType> const&)
Line
Count
Source
1366
2.75k
  static unsigned getHashValue(const KeyTy &Key) { return Key.getHashValue(); }
Unexecuted instantiation: llvm::MDNodeInfo<llvm::DIStringType>::getHashValue(llvm::MDNodeKeyImpl<llvm::DIStringType> const&)
llvm::MDNodeInfo<llvm::DIDerivedType>::getHashValue(llvm::MDNodeKeyImpl<llvm::DIDerivedType> const&)
Line
Count
Source
1366
3.38k
  static unsigned getHashValue(const KeyTy &Key) { return Key.getHashValue(); }
llvm::MDNodeInfo<llvm::DICompositeType>::getHashValue(llvm::MDNodeKeyImpl<llvm::DICompositeType> const&)
Line
Count
Source
1366
18
  static unsigned getHashValue(const KeyTy &Key) { return Key.getHashValue(); }
llvm::MDNodeInfo<llvm::DISubroutineType>::getHashValue(llvm::MDNodeKeyImpl<llvm::DISubroutineType> const&)
Line
Count
Source
1366
165
  static unsigned getHashValue(const KeyTy &Key) { return Key.getHashValue(); }
llvm::MDNodeInfo<llvm::DIFile>::getHashValue(llvm::MDNodeKeyImpl<llvm::DIFile> const&)
Line
Count
Source
1366
69
  static unsigned getHashValue(const KeyTy &Key) { return Key.getHashValue(); }
llvm::MDNodeInfo<llvm::DISubprogram>::getHashValue(llvm::MDNodeKeyImpl<llvm::DISubprogram> const&)
Line
Count
Source
1366
31
  static unsigned getHashValue(const KeyTy &Key) { return Key.getHashValue(); }
Unexecuted instantiation: llvm::MDNodeInfo<llvm::DILexicalBlock>::getHashValue(llvm::MDNodeKeyImpl<llvm::DILexicalBlock> const&)
llvm::MDNodeInfo<llvm::DILexicalBlockFile>::getHashValue(llvm::MDNodeKeyImpl<llvm::DILexicalBlockFile> const&)
Line
Count
Source
1366
166
  static unsigned getHashValue(const KeyTy &Key) { return Key.getHashValue(); }
Unexecuted instantiation: llvm::MDNodeInfo<llvm::DINamespace>::getHashValue(llvm::MDNodeKeyImpl<llvm::DINamespace> const&)
Unexecuted instantiation: llvm::MDNodeInfo<llvm::DICommonBlock>::getHashValue(llvm::MDNodeKeyImpl<llvm::DICommonBlock> const&)
Unexecuted instantiation: llvm::MDNodeInfo<llvm::DIModule>::getHashValue(llvm::MDNodeKeyImpl<llvm::DIModule> const&)
Unexecuted instantiation: llvm::MDNodeInfo<llvm::DITemplateTypeParameter>::getHashValue(llvm::MDNodeKeyImpl<llvm::DITemplateTypeParameter> const&)
Unexecuted instantiation: llvm::MDNodeInfo<llvm::DITemplateValueParameter>::getHashValue(llvm::MDNodeKeyImpl<llvm::DITemplateValueParameter> const&)
llvm::MDNodeInfo<llvm::DIGlobalVariable>::getHashValue(llvm::MDNodeKeyImpl<llvm::DIGlobalVariable> const&)
Line
Count
Source
1366
361
  static unsigned getHashValue(const KeyTy &Key) { return Key.getHashValue(); }
llvm::MDNodeInfo<llvm::DILocalVariable>::getHashValue(llvm::MDNodeKeyImpl<llvm::DILocalVariable> const&)
Line
Count
Source
1366
7.62k
  static unsigned getHashValue(const KeyTy &Key) { return Key.getHashValue(); }
Unexecuted instantiation: llvm::MDNodeInfo<llvm::DILabel>::getHashValue(llvm::MDNodeKeyImpl<llvm::DILabel> const&)
llvm::MDNodeInfo<llvm::DIExpression>::getHashValue(llvm::MDNodeKeyImpl<llvm::DIExpression> const&)
Line
Count
Source
1366
37.3k
  static unsigned getHashValue(const KeyTy &Key) { return Key.getHashValue(); }
llvm::MDNodeInfo<llvm::DIGlobalVariableExpression>::getHashValue(llvm::MDNodeKeyImpl<llvm::DIGlobalVariableExpression> const&)
Line
Count
Source
1366
339
  static unsigned getHashValue(const KeyTy &Key) { return Key.getHashValue(); }
Unexecuted instantiation: llvm::MDNodeInfo<llvm::DIObjCProperty>::getHashValue(llvm::MDNodeKeyImpl<llvm::DIObjCProperty> const&)
Unexecuted instantiation: llvm::MDNodeInfo<llvm::DIImportedEntity>::getHashValue(llvm::MDNodeKeyImpl<llvm::DIImportedEntity> const&)
Unexecuted instantiation: llvm::MDNodeInfo<llvm::DIMacro>::getHashValue(llvm::MDNodeKeyImpl<llvm::DIMacro> const&)
Unexecuted instantiation: llvm::MDNodeInfo<llvm::DIMacroFile>::getHashValue(llvm::MDNodeKeyImpl<llvm::DIMacroFile> const&)
llvm::MDNodeInfo<llvm::MDTuple>::getHashValue(llvm::MDNodeKeyImpl<llvm::MDTuple> const&)
Line
Count
Source
1366
562k
  static unsigned getHashValue(const KeyTy &Key) { return Key.getHashValue(); }
1367
1368
1.15M
  static unsigned getHashValue(const NodeTy *N) {
1369
1.15M
    return KeyTy(N).getHashValue();
1370
1.15M
  }
llvm::MDNodeInfo<llvm::DILocation>::getHashValue(llvm::DILocation const*)
Line
Count
Source
1368
25.1k
  static unsigned getHashValue(const NodeTy *N) {
1369
25.1k
    return KeyTy(N).getHashValue();
1370
25.1k
  }
llvm::MDNodeInfo<llvm::GenericDINode>::getHashValue(llvm::GenericDINode const*)
Line
Count
Source
1368
17
  static unsigned getHashValue(const NodeTy *N) {
1369
17
    return KeyTy(N).getHashValue();
1370
17
  }
llvm::MDNodeInfo<llvm::DISubrange>::getHashValue(llvm::DISubrange const*)
Line
Count
Source
1368
275
  static unsigned getHashValue(const NodeTy *N) {
1369
275
    return KeyTy(N).getHashValue();
1370
275
  }
Unexecuted instantiation: llvm::MDNodeInfo<llvm::DIGenericSubrange>::getHashValue(llvm::DIGenericSubrange const*)
llvm::MDNodeInfo<llvm::DIEnumerator>::getHashValue(llvm::DIEnumerator const*)
Line
Count
Source
1368
17
  static unsigned getHashValue(const NodeTy *N) {
1369
17
    return KeyTy(N).getHashValue();
1370
17
  }
llvm::MDNodeInfo<llvm::DIBasicType>::getHashValue(llvm::DIBasicType const*)
Line
Count
Source
1368
6.69k
  static unsigned getHashValue(const NodeTy *N) {
1369
6.69k
    return KeyTy(N).getHashValue();
1370
6.69k
  }
llvm::MDNodeInfo<llvm::DIStringType>::getHashValue(llvm::DIStringType const*)
Line
Count
Source
1368
1
  static unsigned getHashValue(const NodeTy *N) {
1369
1
    return KeyTy(N).getHashValue();
1370
1
  }
llvm::MDNodeInfo<llvm::DIDerivedType>::getHashValue(llvm::DIDerivedType const*)
Line
Count
Source
1368
5.16k
  static unsigned getHashValue(const NodeTy *N) {
1369
5.16k
    return KeyTy(N).getHashValue();
1370
5.16k
  }
llvm::MDNodeInfo<llvm::DICompositeType>::getHashValue(llvm::DICompositeType const*)
Line
Count
Source
1368
239
  static unsigned getHashValue(const NodeTy *N) {
1369
239
    return KeyTy(N).getHashValue();
1370
239
  }
llvm::MDNodeInfo<llvm::DISubroutineType>::getHashValue(llvm::DISubroutineType const*)
Line
Count
Source
1368
5.01k
  static unsigned getHashValue(const NodeTy *N) {
1369
5.01k
    return KeyTy(N).getHashValue();
1370
5.01k
  }
llvm::MDNodeInfo<llvm::DIFile>::getHashValue(llvm::DIFile const*)
Line
Count
Source
1368
5.26k
  static unsigned getHashValue(const NodeTy *N) {
1369
5.26k
    return KeyTy(N).getHashValue();
1370
5.26k
  }
llvm::MDNodeInfo<llvm::DISubprogram>::getHashValue(llvm::DISubprogram const*)
Line
Count
Source
1368
116
  static unsigned getHashValue(const NodeTy *N) {
1369
116
    return KeyTy(N).getHashValue();
1370
116
  }
llvm::MDNodeInfo<llvm::DILexicalBlock>::getHashValue(llvm::DILexicalBlock const*)
Line
Count
Source
1368
103
  static unsigned getHashValue(const NodeTy *N) {
1369
103
    return KeyTy(N).getHashValue();
1370
103
  }
llvm::MDNodeInfo<llvm::DILexicalBlockFile>::getHashValue(llvm::DILexicalBlockFile const*)
Line
Count
Source
1368
326
  static unsigned getHashValue(const NodeTy *N) {
1369
326
    return KeyTy(N).getHashValue();
1370
326
  }
llvm::MDNodeInfo<llvm::DINamespace>::getHashValue(llvm::DINamespace const*)
Line
Count
Source
1368
3
  static unsigned getHashValue(const NodeTy *N) {
1369
3
    return KeyTy(N).getHashValue();
1370
3
  }
Unexecuted instantiation: llvm::MDNodeInfo<llvm::DICommonBlock>::getHashValue(llvm::DICommonBlock const*)
Unexecuted instantiation: llvm::MDNodeInfo<llvm::DIModule>::getHashValue(llvm::DIModule const*)
llvm::MDNodeInfo<llvm::DITemplateTypeParameter>::getHashValue(llvm::DITemplateTypeParameter const*)
Line
Count
Source
1368
31
  static unsigned getHashValue(const NodeTy *N) {
1369
31
    return KeyTy(N).getHashValue();
1370
31
  }
Unexecuted instantiation: llvm::MDNodeInfo<llvm::DITemplateValueParameter>::getHashValue(llvm::DITemplateValueParameter const*)
llvm::MDNodeInfo<llvm::DIGlobalVariable>::getHashValue(llvm::DIGlobalVariable const*)
Line
Count
Source
1368
571
  static unsigned getHashValue(const NodeTy *N) {
1369
571
    return KeyTy(N).getHashValue();
1370
571
  }
llvm::MDNodeInfo<llvm::DILocalVariable>::getHashValue(llvm::DILocalVariable const*)
Line
Count
Source
1368
11.4k
  static unsigned getHashValue(const NodeTy *N) {
1369
11.4k
    return KeyTy(N).getHashValue();
1370
11.4k
  }
Unexecuted instantiation: llvm::MDNodeInfo<llvm::DILabel>::getHashValue(llvm::DILabel const*)
llvm::MDNodeInfo<llvm::DIExpression>::getHashValue(llvm::DIExpression const*)
Line
Count
Source
1368
40.8k
  static unsigned getHashValue(const NodeTy *N) {
1369
40.8k
    return KeyTy(N).getHashValue();
1370
40.8k
  }
llvm::MDNodeInfo<llvm::DIGlobalVariableExpression>::getHashValue(llvm::DIGlobalVariableExpression const*)
Line
Count
Source
1368
557
  static unsigned getHashValue(const NodeTy *N) {
1369
557
    return KeyTy(N).getHashValue();
1370
557
  }
Unexecuted instantiation: llvm::MDNodeInfo<llvm::DIObjCProperty>::getHashValue(llvm::DIObjCProperty const*)
Unexecuted instantiation: llvm::MDNodeInfo<llvm::DIImportedEntity>::getHashValue(llvm::DIImportedEntity const*)
Unexecuted instantiation: llvm::MDNodeInfo<llvm::DIMacro>::getHashValue(llvm::DIMacro const*)
Unexecuted instantiation: llvm::MDNodeInfo<llvm::DIMacroFile>::getHashValue(llvm::DIMacroFile const*)
llvm::MDNodeInfo<llvm::MDTuple>::getHashValue(llvm::MDTuple const*)
Line
Count
Source
1368
1.05M
  static unsigned getHashValue(const NodeTy *N) {
1369
1.05M
    return KeyTy(N).getHashValue();
1370
1.05M
  }
1371
1372
2.86M
  static bool isEqual(const KeyTy &LHS, const NodeTy *RHS) {
1373
2.86M
    if (RHS == getEmptyKey() || RHS == getTombstoneKey())
1374
2.54M
      return false;
1375
325k
    return SubsetEqualTy::isSubsetEqual(LHS, RHS) || LHS.isKeyOf(RHS);
1376
2.86M
  }
llvm::MDNodeInfo<llvm::DILocation>::isEqual(llvm::MDNodeKeyImpl<llvm::DILocation> const&, llvm::DILocation const*)
Line
Count
Source
1372
82.1k
  static bool isEqual(const KeyTy &LHS, const NodeTy *RHS) {
1373
82.1k
    if (RHS == getEmptyKey() || RHS == getTombstoneKey())
1374
73.2k
      return false;
1375
8.90k
    return SubsetEqualTy::isSubsetEqual(LHS, RHS) || LHS.isKeyOf(RHS);
1376
82.1k
  }
Unexecuted instantiation: llvm::MDNodeInfo<llvm::GenericDINode>::isEqual(llvm::MDNodeKeyImpl<llvm::GenericDINode> const&, llvm::GenericDINode const*)
Unexecuted instantiation: llvm::MDNodeInfo<llvm::DISubrange>::isEqual(llvm::MDNodeKeyImpl<llvm::DISubrange> const&, llvm::DISubrange const*)
Unexecuted instantiation: llvm::MDNodeInfo<llvm::DIGenericSubrange>::isEqual(llvm::MDNodeKeyImpl<llvm::DIGenericSubrange> const&, llvm::DIGenericSubrange const*)
Unexecuted instantiation: llvm::MDNodeInfo<llvm::DIEnumerator>::isEqual(llvm::MDNodeKeyImpl<llvm::DIEnumerator> const&, llvm::DIEnumerator const*)
llvm::MDNodeInfo<llvm::DIBasicType>::isEqual(llvm::MDNodeKeyImpl<llvm::DIBasicType> const&, llvm::DIBasicType const*)
Line
Count
Source
1372
8.29k
  static bool isEqual(const KeyTy &LHS, const NodeTy *RHS) {
1373
8.29k
    if (RHS == getEmptyKey() || RHS == getTombstoneKey())
1374
8.26k
      return false;
1375
27
    return SubsetEqualTy::isSubsetEqual(LHS, RHS) || LHS.isKeyOf(RHS);
1376
8.29k
  }
Unexecuted instantiation: llvm::MDNodeInfo<llvm::DIStringType>::isEqual(llvm::MDNodeKeyImpl<llvm::DIStringType> const&, llvm::DIStringType const*)
llvm::MDNodeInfo<llvm::DIDerivedType>::isEqual(llvm::MDNodeKeyImpl<llvm::DIDerivedType> const&, llvm::DIDerivedType const*)
Line
Count
Source
1372
10.2k
  static bool isEqual(const KeyTy &LHS, const NodeTy *RHS) {
1373
10.2k
    if (RHS == getEmptyKey() || RHS == getTombstoneKey())
1374
10.1k
      return false;
1375
99
    return SubsetEqualTy::isSubsetEqual(LHS, RHS) || LHS.isKeyOf(RHS);
1376
10.2k
  }
llvm::MDNodeInfo<llvm::DICompositeType>::isEqual(llvm::MDNodeKeyImpl<llvm::DICompositeType> const&, llvm::DICompositeType const*)
Line
Count
Source
1372
54
  static bool isEqual(const KeyTy &LHS, const NodeTy *RHS) {
1373
54
    if (RHS == getEmptyKey() || RHS == getTombstoneKey())
1374
54
      return false;
1375
0
    return SubsetEqualTy::isSubsetEqual(LHS, RHS) || LHS.isKeyOf(RHS);
1376
54
  }
llvm::MDNodeInfo<llvm::DISubroutineType>::isEqual(llvm::MDNodeKeyImpl<llvm::DISubroutineType> const&, llvm::DISubroutineType const*)
Line
Count
Source
1372
497
  static bool isEqual(const KeyTy &LHS, const NodeTy *RHS) {
1373
497
    if (RHS == getEmptyKey() || RHS == getTombstoneKey())
1374
495
      return false;
1375
2
    return SubsetEqualTy::isSubsetEqual(LHS, RHS) || LHS.isKeyOf(RHS);
1376
497
  }
llvm::MDNodeInfo<llvm::DIFile>::isEqual(llvm::MDNodeKeyImpl<llvm::DIFile> const&, llvm::DIFile const*)
Line
Count
Source
1372
210
  static bool isEqual(const KeyTy &LHS, const NodeTy *RHS) {
1373
210
    if (RHS == getEmptyKey() || RHS == getTombstoneKey())
1374
207
      return false;
1375
3
    return SubsetEqualTy::isSubsetEqual(LHS, RHS) || LHS.isKeyOf(RHS);
1376
210
  }
llvm::MDNodeInfo<llvm::DISubprogram>::isEqual(llvm::MDNodeKeyImpl<llvm::DISubprogram> const&, llvm::DISubprogram const*)
Line
Count
Source
1372
94
  static bool isEqual(const KeyTy &LHS, const NodeTy *RHS) {
1373
94
    if (RHS == getEmptyKey() || RHS == getTombstoneKey())
1374
93
      return false;
1375
1
    return SubsetEqualTy::isSubsetEqual(LHS, RHS) || LHS.isKeyOf(RHS);
1376
94
  }
Unexecuted instantiation: llvm::MDNodeInfo<llvm::DILexicalBlock>::isEqual(llvm::MDNodeKeyImpl<llvm::DILexicalBlock> const&, llvm::DILexicalBlock const*)
llvm::MDNodeInfo<llvm::DILexicalBlockFile>::isEqual(llvm::MDNodeKeyImpl<llvm::DILexicalBlockFile> const&, llvm::DILexicalBlockFile const*)
Line
Count
Source
1372
500
  static bool isEqual(const KeyTy &LHS, const NodeTy *RHS) {
1373
500
    if (RHS == getEmptyKey() || RHS == getTombstoneKey())
1374
498
      return false;
1375
2
    return SubsetEqualTy::isSubsetEqual(LHS, RHS) || LHS.isKeyOf(RHS);
1376
500
  }
Unexecuted instantiation: llvm::MDNodeInfo<llvm::DINamespace>::isEqual(llvm::MDNodeKeyImpl<llvm::DINamespace> const&, llvm::DINamespace const*)
Unexecuted instantiation: llvm::MDNodeInfo<llvm::DICommonBlock>::isEqual(llvm::MDNodeKeyImpl<llvm::DICommonBlock> const&, llvm::DICommonBlock const*)
Unexecuted instantiation: llvm::MDNodeInfo<llvm::DIModule>::isEqual(llvm::MDNodeKeyImpl<llvm::DIModule> const&, llvm::DIModule const*)
Unexecuted instantiation: llvm::MDNodeInfo<llvm::DITemplateTypeParameter>::isEqual(llvm::MDNodeKeyImpl<llvm::DITemplateTypeParameter> const&, llvm::DITemplateTypeParameter const*)
Unexecuted instantiation: llvm::MDNodeInfo<llvm::DITemplateValueParameter>::isEqual(llvm::MDNodeKeyImpl<llvm::DITemplateValueParameter> const&, llvm::DITemplateValueParameter const*)
llvm::MDNodeInfo<llvm::DIGlobalVariable>::isEqual(llvm::MDNodeKeyImpl<llvm::DIGlobalVariable> const&, llvm::DIGlobalVariable const*)
Line
Count
Source
1372
1.09k
  static bool isEqual(const KeyTy &LHS, const NodeTy *RHS) {
1373
1.09k
    if (RHS == getEmptyKey() || RHS == getTombstoneKey())
1374
1.08k
      return false;
1375
8
    return SubsetEqualTy::isSubsetEqual(LHS, RHS) || LHS.isKeyOf(RHS);
1376
1.09k
  }
llvm::MDNodeInfo<llvm::DILocalVariable>::isEqual(llvm::MDNodeKeyImpl<llvm::DILocalVariable> const&, llvm::DILocalVariable const*)
Line
Count
Source
1372
23.1k
  static bool isEqual(const KeyTy &LHS, const NodeTy *RHS) {
1373
23.1k
    if (RHS == getEmptyKey() || RHS == getTombstoneKey())
1374
22.8k
      return false;
1375
243
    return SubsetEqualTy::isSubsetEqual(LHS, RHS) || LHS.isKeyOf(RHS);
1376
23.1k
  }
Unexecuted instantiation: llvm::MDNodeInfo<llvm::DILabel>::isEqual(llvm::MDNodeKeyImpl<llvm::DILabel> const&, llvm::DILabel const*)
llvm::MDNodeInfo<llvm::DIExpression>::isEqual(llvm::MDNodeKeyImpl<llvm::DIExpression> const&, llvm::DIExpression const*)
Line
Count
Source
1372
133k
  static bool isEqual(const KeyTy &LHS, const NodeTy *RHS) {
1373
133k
    if (RHS == getEmptyKey() || RHS == getTombstoneKey())
1374
102k
      return false;
1375
30.3k
    return SubsetEqualTy::isSubsetEqual(LHS, RHS) || LHS.isKeyOf(RHS);
1376
133k
  }
llvm::MDNodeInfo<llvm::DIGlobalVariableExpression>::isEqual(llvm::MDNodeKeyImpl<llvm::DIGlobalVariableExpression> const&, llvm::DIGlobalVariableExpression const*)
Line
Count
Source
1372
1.02k
  static bool isEqual(const KeyTy &LHS, const NodeTy *RHS) {
1373
1.02k
    if (RHS == getEmptyKey() || RHS == getTombstoneKey())
1374
1.01k
      return false;
1375
10
    return SubsetEqualTy::isSubsetEqual(LHS, RHS) || LHS.isKeyOf(RHS);
1376
1.02k
  }
Unexecuted instantiation: llvm::MDNodeInfo<llvm::DIObjCProperty>::isEqual(llvm::MDNodeKeyImpl<llvm::DIObjCProperty> const&, llvm::DIObjCProperty const*)
Unexecuted instantiation: llvm::MDNodeInfo<llvm::DIImportedEntity>::isEqual(llvm::MDNodeKeyImpl<llvm::DIImportedEntity> const&, llvm::DIImportedEntity const*)
Unexecuted instantiation: llvm::MDNodeInfo<llvm::DIMacro>::isEqual(llvm::MDNodeKeyImpl<llvm::DIMacro> const&, llvm::DIMacro const*)
Unexecuted instantiation: llvm::MDNodeInfo<llvm::DIMacroFile>::isEqual(llvm::MDNodeKeyImpl<llvm::DIMacroFile> const&, llvm::DIMacroFile const*)
llvm::MDNodeInfo<llvm::MDTuple>::isEqual(llvm::MDNodeKeyImpl<llvm::MDTuple> const&, llvm::MDTuple const*)
Line
Count
Source
1372
2.60M
  static bool isEqual(const KeyTy &LHS, const NodeTy *RHS) {
1373
2.60M
    if (RHS == getEmptyKey() || RHS == getTombstoneKey())
1374
2.31M
      return false;
1375
285k
    return SubsetEqualTy::isSubsetEqual(LHS, RHS) || LHS.isKeyOf(RHS);
1376
2.60M
  }
1377
1378
20.3M
  static bool isEqual(const NodeTy *LHS, const NodeTy *RHS) {
1379
20.3M
    if (LHS == RHS)
1380
11.9M
      return true;
1381
8.46M
    if (RHS == getEmptyKey() || RHS == getTombstoneKey())
1382
8.09M
      return false;
1383
368k
    return SubsetEqualTy::isSubsetEqual(LHS, RHS);
1384
8.46M
  }
llvm::MDNodeInfo<llvm::DILocation>::isEqual(llvm::DILocation const*, llvm::DILocation const*)
Line
Count
Source
1378
1.17M
  static bool isEqual(const NodeTy *LHS, const NodeTy *RHS) {
1379
1.17M
    if (LHS == RHS)
1380
936k
      return true;
1381
238k
    if (RHS == getEmptyKey() || RHS == getTombstoneKey())
1382
236k
      return false;
1383
2.31k
    return SubsetEqualTy::isSubsetEqual(LHS, RHS);
1384
238k
  }
llvm::MDNodeInfo<llvm::GenericDINode>::isEqual(llvm::GenericDINode const*, llvm::GenericDINode const*)
Line
Count
Source
1378
3.40k
  static bool isEqual(const NodeTy *LHS, const NodeTy *RHS) {
1379
3.40k
    if (LHS == RHS)
1380
3.24k
      return true;
1381
153
    if (RHS == getEmptyKey() || RHS == getTombstoneKey())
1382
153
      return false;
1383
0
    return SubsetEqualTy::isSubsetEqual(LHS, RHS);
1384
153
  }
llvm::MDNodeInfo<llvm::DISubrange>::isEqual(llvm::DISubrange const*, llvm::DISubrange const*)
Line
Count
Source
1378
55.0k
  static bool isEqual(const NodeTy *LHS, const NodeTy *RHS) {
1379
55.0k
    if (LHS == RHS)
1380
52.5k
      return true;
1381
2.47k
    if (RHS == getEmptyKey() || RHS == getTombstoneKey())
1382
2.47k
      return false;
1383
0
    return SubsetEqualTy::isSubsetEqual(LHS, RHS);
1384
2.47k
  }
Unexecuted instantiation: llvm::MDNodeInfo<llvm::DIGenericSubrange>::isEqual(llvm::DIGenericSubrange const*, llvm::DIGenericSubrange const*)
llvm::MDNodeInfo<llvm::DIEnumerator>::isEqual(llvm::DIEnumerator const*, llvm::DIEnumerator const*)
Line
Count
Source
1378
3.40k
  static bool isEqual(const NodeTy *LHS, const NodeTy *RHS) {
1379
3.40k
    if (LHS == RHS)
1380
3.24k
      return true;
1381
153
    if (RHS == getEmptyKey() || RHS == getTombstoneKey())
1382
153
      return false;
1383
0
    return SubsetEqualTy::isSubsetEqual(LHS, RHS);
1384
153
  }
llvm::MDNodeInfo<llvm::DIBasicType>::isEqual(llvm::DIBasicType const*, llvm::DIBasicType const*)
Line
Count
Source
1378
812k
  static bool isEqual(const NodeTy *LHS, const NodeTy *RHS) {
1379
812k
    if (LHS == RHS)
1380
752k
      return true;
1381
60.3k
    if (RHS == getEmptyKey() || RHS == getTombstoneKey())
1382
60.3k
      return false;
1383
27
    return SubsetEqualTy::isSubsetEqual(LHS, RHS);
1384
60.3k
  }
llvm::MDNodeInfo<llvm::DIStringType>::isEqual(llvm::DIStringType const*, llvm::DIStringType const*)
Line
Count
Source
1378
200
  static bool isEqual(const NodeTy *LHS, const NodeTy *RHS) {
1379
200
    if (LHS == RHS)
1380
191
      return true;
1381
9
    if (RHS == getEmptyKey() || RHS == getTombstoneKey())
1382
9
      return false;
1383
0
    return SubsetEqualTy::isSubsetEqual(LHS, RHS);
1384
9
  }
llvm::MDNodeInfo<llvm::DIDerivedType>::isEqual(llvm::DIDerivedType const*, llvm::DIDerivedType const*)
Line
Count
Source
1378
375k
  static bool isEqual(const NodeTy *LHS, const NodeTy *RHS) {
1379
375k
    if (LHS == RHS)
1380
329k
      return true;
1381
46.4k
    if (RHS == getEmptyKey() || RHS == getTombstoneKey())
1382
46.3k
      return false;
1383
101
    return SubsetEqualTy::isSubsetEqual(LHS, RHS);
1384
46.4k
  }
llvm::MDNodeInfo<llvm::DICompositeType>::isEqual(llvm::DICompositeType const*, llvm::DICompositeType const*)
Line
Count
Source
1378
40.8k
  static bool isEqual(const NodeTy *LHS, const NodeTy *RHS) {
1379
40.8k
    if (LHS == RHS)
1380
38.8k
      return true;
1381
1.97k
    if (RHS == getEmptyKey() || RHS == getTombstoneKey())
1382
1.97k
      return false;
1383
0
    return SubsetEqualTy::isSubsetEqual(LHS, RHS);
1384
1.97k
  }
llvm::MDNodeInfo<llvm::DISubroutineType>::isEqual(llvm::DISubroutineType const*, llvm::DISubroutineType const*)
Line
Count
Source
1378
971k
  static bool isEqual(const NodeTy *LHS, const NodeTy *RHS) {
1379
971k
    if (LHS == RHS)
1380
925k
      return true;
1381
45.1k
    if (RHS == getEmptyKey() || RHS == getTombstoneKey())
1382
45.1k
      return false;
1383
2
    return SubsetEqualTy::isSubsetEqual(LHS, RHS);
1384
45.1k
  }
llvm::MDNodeInfo<llvm::DIFile>::isEqual(llvm::DIFile const*, llvm::DIFile const*)
Line
Count
Source
1378
1.03M
  static bool isEqual(const NodeTy *LHS, const NodeTy *RHS) {
1379
1.03M
    if (LHS == RHS)
1380
991k
      return true;
1381
47.3k
    if (RHS == getEmptyKey() || RHS == getTombstoneKey())
1382
47.3k
      return false;
1383
3
    return SubsetEqualTy::isSubsetEqual(LHS, RHS);
1384
47.3k
  }
llvm::MDNodeInfo<llvm::DISubprogram>::isEqual(llvm::DISubprogram const*, llvm::DISubprogram const*)
Line
Count
Source
1378
17.2k
  static bool isEqual(const NodeTy *LHS, const NodeTy *RHS) {
1379
17.2k
    if (LHS == RHS)
1380
16.2k
      return true;
1381
1.04k
    if (RHS == getEmptyKey() || RHS == getTombstoneKey())
1382
1.04k
      return false;
1383
1
    return SubsetEqualTy::isSubsetEqual(LHS, RHS);
1384
1.04k
  }
llvm::MDNodeInfo<llvm::DILexicalBlock>::isEqual(llvm::DILexicalBlock const*, llvm::DILexicalBlock const*)
Line
Count
Source
1378
20.6k
  static bool isEqual(const NodeTy *LHS, const NodeTy *RHS) {
1379
20.6k
    if (LHS == RHS)
1380
19.6k
      return true;
1381
927
    if (RHS == getEmptyKey() || RHS == getTombstoneKey())
1382
927
      return false;
1383
0
    return SubsetEqualTy::isSubsetEqual(LHS, RHS);
1384
927
  }
llvm::MDNodeInfo<llvm::DILexicalBlockFile>::isEqual(llvm::DILexicalBlockFile const*, llvm::DILexicalBlockFile const*)
Line
Count
Source
1378
33.5k
  static bool isEqual(const NodeTy *LHS, const NodeTy *RHS) {
1379
33.5k
    if (LHS == RHS)
1380
30.5k
      return true;
1381
2.94k
    if (RHS == getEmptyKey() || RHS == getTombstoneKey())
1382
2.94k
      return false;
1383
2
    return SubsetEqualTy::isSubsetEqual(LHS, RHS);
1384
2.94k
  }
llvm::MDNodeInfo<llvm::DINamespace>::isEqual(llvm::DINamespace const*, llvm::DINamespace const*)
Line
Count
Source
1378
600
  static bool isEqual(const NodeTy *LHS, const NodeTy *RHS) {
1379
600
    if (LHS == RHS)
1380
573
      return true;
1381
27
    if (RHS == getEmptyKey() || RHS == getTombstoneKey())
1382
27
      return false;
1383
0
    return SubsetEqualTy::isSubsetEqual(LHS, RHS);
1384
27
  }
Unexecuted instantiation: llvm::MDNodeInfo<llvm::DICommonBlock>::isEqual(llvm::DICommonBlock const*, llvm::DICommonBlock const*)
Unexecuted instantiation: llvm::MDNodeInfo<llvm::DIModule>::isEqual(llvm::DIModule const*, llvm::DIModule const*)
llvm::MDNodeInfo<llvm::DITemplateTypeParameter>::isEqual(llvm::DITemplateTypeParameter const*, llvm::DITemplateTypeParameter const*)
Line
Count
Source
1378
4.89k
  static bool isEqual(const NodeTy *LHS, const NodeTy *RHS) {
1379
4.89k
    if (LHS == RHS)
1380
4.66k
      return true;
1381
231
    if (RHS == getEmptyKey() || RHS == getTombstoneKey())
1382
231
      return false;
1383
0
    return SubsetEqualTy::isSubsetEqual(LHS, RHS);
1384
231
  }
Unexecuted instantiation: llvm::MDNodeInfo<llvm::DITemplateValueParameter>::isEqual(llvm::DITemplateValueParameter const*, llvm::DITemplateValueParameter const*)
llvm::MDNodeInfo<llvm::DIGlobalVariable>::isEqual(llvm::DIGlobalVariable const*, llvm::DIGlobalVariable const*)
Line
Count
Source
1378
37.6k
  static bool isEqual(const NodeTy *LHS, const NodeTy *RHS) {
1379
37.6k
    if (LHS == RHS)
1380
32.8k
      return true;
1381
4.79k
    if (RHS == getEmptyKey() || RHS == getTombstoneKey())
1382
4.78k
      return false;
1383
9
    return SubsetEqualTy::isSubsetEqual(LHS, RHS);
1384
4.79k
  }
llvm::MDNodeInfo<llvm::DILocalVariable>::isEqual(llvm::DILocalVariable const*, llvm::DILocalVariable const*)
Line
Count
Source
1378
830k
  static bool isEqual(const NodeTy *LHS, const NodeTy *RHS) {
1379
830k
    if (LHS == RHS)
1380
726k
      return true;
1381
104k
    if (RHS == getEmptyKey() || RHS == getTombstoneKey())
1382
103k
      return false;
1383
244
    return SubsetEqualTy::isSubsetEqual(LHS, RHS);
1384
104k
  }
Unexecuted instantiation: llvm::MDNodeInfo<llvm::DILabel>::isEqual(llvm::DILabel const*, llvm::DILabel const*)
llvm::MDNodeInfo<llvm::DIExpression>::isEqual(llvm::DIExpression const*, llvm::DIExpression const*)
Line
Count
Source
1378
1.17M
  static bool isEqual(const NodeTy *LHS, const NodeTy *RHS) {
1379
1.17M
    if (LHS == RHS)
1380
744k
      return true;
1381
429k
    if (RHS == getEmptyKey() || RHS == getTombstoneKey())
1382
410k
      return false;
1383
19.3k
    return SubsetEqualTy::isSubsetEqual(LHS, RHS);
1384
429k
  }
llvm::MDNodeInfo<llvm::DIGlobalVariableExpression>::isEqual(llvm::DIGlobalVariableExpression const*, llvm::DIGlobalVariableExpression const*)
Line
Count
Source
1378
46.7k
  static bool isEqual(const NodeTy *LHS, const NodeTy *RHS) {
1379
46.7k
    if (LHS == RHS)
1380
41.6k
      return true;
1381
5.06k
    if (RHS == getEmptyKey() || RHS == getTombstoneKey())
1382
5.05k
      return false;
1383
10
    return SubsetEqualTy::isSubsetEqual(LHS, RHS);
1384
5.06k
  }
Unexecuted instantiation: llvm::MDNodeInfo<llvm::DIObjCProperty>::isEqual(llvm::DIObjCProperty const*, llvm::DIObjCProperty const*)
Unexecuted instantiation: llvm::MDNodeInfo<llvm::DIImportedEntity>::isEqual(llvm::DIImportedEntity const*, llvm::DIImportedEntity const*)
Unexecuted instantiation: llvm::MDNodeInfo<llvm::DIMacro>::isEqual(llvm::DIMacro const*, llvm::DIMacro const*)
Unexecuted instantiation: llvm::MDNodeInfo<llvm::DIMacroFile>::isEqual(llvm::DIMacroFile const*, llvm::DIMacroFile const*)
llvm::MDNodeInfo<llvm::MDTuple>::isEqual(llvm::MDTuple const*, llvm::MDTuple const*)
Line
Count
Source
1378
13.7M
  static bool isEqual(const NodeTy *LHS, const NodeTy *RHS) {
1379
13.7M
    if (LHS == RHS)
1380
6.25M
      return true;
1381
7.46M
    if (RHS == getEmptyKey() || RHS == getTombstoneKey())
1382
7.12M
      return false;
1383
346k
    return SubsetEqualTy::isSubsetEqual(LHS, RHS);
1384
7.46M
  }
1385
};
1386
1387
#define HANDLE_MDNODE_LEAF(CLASS) using CLASS##Info = MDNodeInfo<CLASS>;
1388
#include "llvm/IR/Metadata.def"
1389
1390
/// Multimap-like storage for metadata attachments.
1391
class MDAttachments {
1392
public:
1393
  struct Attachment {
1394
    unsigned MDKind;
1395
    TrackingMDNodeRef Node;
1396
  };
1397
1398
private:
1399
  SmallVector<Attachment, 1> Attachments;
1400
1401
public:
1402
845k
  bool empty() const { return Attachments.empty(); }
1403
0
  size_t size() const { return Attachments.size(); }
1404
1405
  /// Returns the first attachment with the given ID or nullptr if no such
1406
  /// attachment exists.
1407
  MDNode *lookup(unsigned ID) const;
1408
1409
  /// Appends all attachments with the given ID to \c Result in insertion order.
1410
  /// If the global has no attachments with the given ID, or if ID is invalid,
1411
  /// leaves Result unchanged.
1412
  void get(unsigned ID, SmallVectorImpl<MDNode *> &Result) const;
1413
1414
  /// Appends all attachments for the global to \c Result, sorting by attachment
1415
  /// ID. Attachments with the same ID appear in insertion order. This function
1416
  /// does \em not clear \c Result.
1417
  void getAll(SmallVectorImpl<std::pair<unsigned, MDNode *>> &Result) const;
1418
1419
  /// Set an attachment to a particular node.
1420
  ///
1421
  /// Set the \c ID attachment to \c MD, replacing the current attachments at \c
1422
  /// ID (if anyway).
1423
  void set(unsigned ID, MDNode *MD);
1424
1425
  /// Adds an attachment to a particular node.
1426
  void insert(unsigned ID, MDNode &MD);
1427
1428
  /// Remove attachments with the given ID.
1429
  ///
1430
  /// Remove the attachments at \c ID, if any.
1431
  bool erase(unsigned ID);
1432
1433
  /// Erase matching attachments.
1434
  ///
1435
  /// Erases all attachments matching the \c shouldRemove predicate.
1436
269
  template <class PredTy> void remove_if(PredTy shouldRemove) {
1437
269
    llvm::erase_if(Attachments, shouldRemove);
1438
269
  }
1439
};
1440
1441
class LLVMContextImpl {
1442
public:
1443
  /// OwnedModules - The set of modules instantiated in this context, and which
1444
  /// will be automatically deleted if this context is deleted.
1445
  SmallPtrSet<Module *, 4> OwnedModules;
1446
1447
  /// The main remark streamer used by all the other streamers (e.g. IR, MIR,
1448
  /// frontends, etc.). This should only be used by the specific streamers, and
1449
  /// never directly.
1450
  std::unique_ptr<remarks::RemarkStreamer> MainRemarkStreamer;
1451
1452
  std::unique_ptr<DiagnosticHandler> DiagHandler;
1453
  bool RespectDiagnosticFilters = false;
1454
  bool DiagnosticsHotnessRequested = false;
1455
  /// The minimum hotness value a diagnostic needs in order to be included in
1456
  /// optimization diagnostics.
1457
  ///
1458
  /// The threshold is an Optional value, which maps to one of the 3 states:
1459
  /// 1). 0            => threshold disabled. All emarks will be printed.
1460
  /// 2). positive int => manual threshold by user. Remarks with hotness exceed
1461
  ///                     threshold will be printed.
1462
  /// 3). None         => 'auto' threshold by user. The actual value is not
1463
  ///                     available at command line, but will be synced with
1464
  ///                     hotness threhold from profile summary during
1465
  ///                     compilation.
1466
  ///
1467
  /// State 1 and 2 are considered as terminal states. State transition is
1468
  /// only allowed from 3 to 2, when the threshold is first synced with profile
1469
  /// summary. This ensures that the threshold is set only once and stays
1470
  /// constant.
1471
  ///
1472
  /// If threshold option is not specified, it is disabled (0) by default.
1473
  std::optional<uint64_t> DiagnosticsHotnessThreshold = 0;
1474
1475
  /// The percentage of difference between profiling branch weights and
1476
  /// llvm.expect branch weights to tolerate when emiting MisExpect diagnostics
1477
  std::optional<uint32_t> DiagnosticsMisExpectTolerance = 0;
1478
  bool MisExpectWarningRequested = false;
1479
1480
  /// The specialized remark streamer used by LLVM's OptimizationRemarkEmitter.
1481
  std::unique_ptr<LLVMRemarkStreamer> LLVMRS;
1482
1483
  LLVMContext::YieldCallbackTy YieldCallback = nullptr;
1484
  void *YieldOpaqueHandle = nullptr;
1485
1486
  DenseMap<const Value *, ValueName *> ValueNames;
1487
1488
  DenseMap<unsigned, std::unique_ptr<ConstantInt>> IntZeroConstants;
1489
  DenseMap<unsigned, std::unique_ptr<ConstantInt>> IntOneConstants;
1490
  DenseMap<APInt, std::unique_ptr<ConstantInt>> IntConstants;
1491
1492
  DenseMap<APFloat, std::unique_ptr<ConstantFP>> FPConstants;
1493
1494
  FoldingSet<AttributeImpl> AttrsSet;
1495
  FoldingSet<AttributeListImpl> AttrsLists;
1496
  FoldingSet<AttributeSetNode> AttrsSetNodes;
1497
1498
  StringMap<MDString, BumpPtrAllocator> MDStringCache;
1499
  DenseMap<Value *, ValueAsMetadata *> ValuesAsMetadata;
1500
  DenseMap<Metadata *, MetadataAsValue *> MetadataAsValues;
1501
  DenseSet<DIArgList *, DIArgListInfo> DIArgLists;
1502
1503
#define HANDLE_MDNODE_LEAF_UNIQUABLE(CLASS)                                    \
1504
  DenseSet<CLASS *, CLASS##Info> CLASS##s;
1505
#include "llvm/IR/Metadata.def"
1506
1507
  // Optional map for looking up composite types by identifier.
1508
  std::optional<DenseMap<const MDString *, DICompositeType *>> DITypeMap;
1509
1510
  // MDNodes may be uniqued or not uniqued.  When they're not uniqued, they
1511
  // aren't in the MDNodeSet, but they're still shared between objects, so no
1512
  // one object can destroy them.  Keep track of them here so we can delete
1513
  // them on context teardown.
1514
  std::vector<MDNode *> DistinctMDNodes;
1515
1516
  DenseMap<Type *, std::unique_ptr<ConstantAggregateZero>> CAZConstants;
1517
1518
  using ArrayConstantsTy = ConstantUniqueMap<ConstantArray>;
1519
  ArrayConstantsTy ArrayConstants;
1520
1521
  using StructConstantsTy = ConstantUniqueMap<ConstantStruct>;
1522
  StructConstantsTy StructConstants;
1523
1524
  using VectorConstantsTy = ConstantUniqueMap<ConstantVector>;
1525
  VectorConstantsTy VectorConstants;
1526
1527
  DenseMap<PointerType *, std::unique_ptr<ConstantPointerNull>> CPNConstants;
1528
1529
  DenseMap<TargetExtType *, std::unique_ptr<ConstantTargetNone>> CTNConstants;
1530
1531
  DenseMap<Type *, std::unique_ptr<UndefValue>> UVConstants;
1532
1533
  DenseMap<Type *, std::unique_ptr<PoisonValue>> PVConstants;
1534
1535
  StringMap<std::unique_ptr<ConstantDataSequential>> CDSConstants;
1536
1537
  DenseMap<std::pair<const Function *, const BasicBlock *>, BlockAddress *>
1538
      BlockAddresses;
1539
1540
  DenseMap<const GlobalValue *, DSOLocalEquivalent *> DSOLocalEquivalents;
1541
1542
  DenseMap<const GlobalValue *, NoCFIValue *> NoCFIValues;
1543
1544
  ConstantUniqueMap<ConstantExpr> ExprConstants;
1545
1546
  ConstantUniqueMap<InlineAsm> InlineAsms;
1547
1548
  ConstantInt *TheTrueVal = nullptr;
1549
  ConstantInt *TheFalseVal = nullptr;
1550
1551
  // Basic type instances.
1552
  Type VoidTy, LabelTy, HalfTy, BFloatTy, FloatTy, DoubleTy, MetadataTy,
1553
      TokenTy;
1554
  Type X86_FP80Ty, FP128Ty, PPC_FP128Ty, X86_MMXTy, X86_AMXTy;
1555
  IntegerType Int1Ty, Int8Ty, Int16Ty, Int32Ty, Int64Ty, Int128Ty;
1556
1557
  std::unique_ptr<ConstantTokenNone> TheNoneToken;
1558
1559
  BumpPtrAllocator Alloc;
1560
  UniqueStringSaver Saver{Alloc};
1561
1562
  DenseMap<unsigned, IntegerType *> IntegerTypes;
1563
1564
  using FunctionTypeSet = DenseSet<FunctionType *, FunctionTypeKeyInfo>;
1565
  FunctionTypeSet FunctionTypes;
1566
  using StructTypeSet = DenseSet<StructType *, AnonStructTypeKeyInfo>;
1567
  StructTypeSet AnonStructTypes;
1568
  StringMap<StructType *> NamedStructTypes;
1569
  unsigned NamedStructTypesUniqueID = 0;
1570
1571
  using TargetExtTypeSet = DenseSet<TargetExtType *, TargetExtTypeKeyInfo>;
1572
  TargetExtTypeSet TargetExtTypes;
1573
1574
  DenseMap<std::pair<Type *, uint64_t>, ArrayType *> ArrayTypes;
1575
  DenseMap<std::pair<Type *, ElementCount>, VectorType *> VectorTypes;
1576
  PointerType *AS0PointerType = nullptr; // AddrSpace = 0
1577
  DenseMap<unsigned, PointerType *> PointerTypes;
1578
  DenseMap<std::pair<Type *, unsigned>, PointerType *> LegacyPointerTypes;
1579
  DenseMap<std::pair<Type *, unsigned>, TypedPointerType *> ASTypedPointerTypes;
1580
1581
  /// ValueHandles - This map keeps track of all of the value handles that are
1582
  /// watching a Value*.  The Value::HasValueHandle bit is used to know
1583
  /// whether or not a value has an entry in this map.
1584
  using ValueHandlesTy = DenseMap<Value *, ValueHandleBase *>;
1585
  ValueHandlesTy ValueHandles;
1586
1587
  /// CustomMDKindNames - Map to hold the metadata string to ID mapping.
1588
  StringMap<unsigned> CustomMDKindNames;
1589
1590
  /// Collection of metadata used in this context.
1591
  DenseMap<const Value *, MDAttachments> ValueMetadata;
1592
1593
  /// Map DIAssignID -> Instructions with that attachment.
1594
  /// Managed by Instruction via Instruction::updateDIAssignIDMapping.
1595
  /// Query using the at:: functions defined in DebugInfo.h.
1596
  DenseMap<DIAssignID *, SmallVector<Instruction *, 1>> AssignmentIDToInstrs;
1597
1598
  /// Collection of per-GlobalObject sections used in this context.
1599
  DenseMap<const GlobalObject *, StringRef> GlobalObjectSections;
1600
1601
  /// Collection of per-GlobalValue partitions used in this context.
1602
  DenseMap<const GlobalValue *, StringRef> GlobalValuePartitions;
1603
1604
  DenseMap<const GlobalValue *, GlobalValue::SanitizerMetadata>
1605
      GlobalValueSanitizerMetadata;
1606
1607
  /// DiscriminatorTable - This table maps file:line locations to an
1608
  /// integer representing the next DWARF path discriminator to assign to
1609
  /// instructions in different blocks at the same location.
1610
  DenseMap<std::pair<const char *, unsigned>, unsigned> DiscriminatorTable;
1611
1612
  /// A set of interned tags for operand bundles.  The StringMap maps
1613
  /// bundle tags to their IDs.
1614
  ///
1615
  /// \see LLVMContext::getOperandBundleTagID
1616
  StringMap<uint32_t> BundleTagCache;
1617
1618
  StringMapEntry<uint32_t> *getOrInsertBundleTag(StringRef Tag);
1619
  void getOperandBundleTags(SmallVectorImpl<StringRef> &Tags) const;
1620
  uint32_t getOperandBundleTagID(StringRef Tag) const;
1621
1622
  /// A set of interned synchronization scopes.  The StringMap maps
1623
  /// synchronization scope names to their respective synchronization scope IDs.
1624
  StringMap<SyncScope::ID> SSC;
1625
1626
  /// getOrInsertSyncScopeID - Maps synchronization scope name to
1627
  /// synchronization scope ID.  Every synchronization scope registered with
1628
  /// LLVMContext has unique ID except pre-defined ones.
1629
  SyncScope::ID getOrInsertSyncScopeID(StringRef SSN);
1630
1631
  /// getSyncScopeNames - Populates client supplied SmallVector with
1632
  /// synchronization scope names registered with LLVMContext.  Synchronization
1633
  /// scope names are ordered by increasing synchronization scope IDs.
1634
  void getSyncScopeNames(SmallVectorImpl<StringRef> &SSNs) const;
1635
1636
  /// Maintain the GC name for each function.
1637
  ///
1638
  /// This saves allocating an additional word in Function for programs which
1639
  /// do not use GC (i.e., most programs) at the cost of increased overhead for
1640
  /// clients which do use GC.
1641
  DenseMap<const Function *, std::string> GCNames;
1642
1643
  /// Flag to indicate if Value (other than GlobalValue) retains their name or
1644
  /// not.
1645
  bool DiscardValueNames = false;
1646
1647
  LLVMContextImpl(LLVMContext &C);
1648
  ~LLVMContextImpl();
1649
1650
  /// Destroy the ConstantArrays if they are not used.
1651
  void dropTriviallyDeadConstantArrays();
1652
1653
  mutable OptPassGate *OPG = nullptr;
1654
1655
  /// Access the object which can disable optional passes and individual
1656
  /// optimizations at compile time.
1657
  OptPassGate &getOptPassGate() const;
1658
1659
  /// Set the object which can disable optional passes and individual
1660
  /// optimizations at compile time.
1661
  ///
1662
  /// The lifetime of the object must be guaranteed to extend as long as the
1663
  /// LLVMContext is used by compilation.
1664
  void setOptPassGate(OptPassGate &);
1665
1666
  /// Mapping of blocks to collections of "trailing" DPValues. As part of the
1667
  /// "RemoveDIs" project, debug-info variable location records are going to
1668
  /// cease being instructions... which raises the problem of where should they
1669
  /// be recorded when we remove the terminator of a blocks, such as:
1670
  ///
1671
  ///    %foo = add i32 0, 0
1672
  ///    br label %bar
1673
  ///
1674
  /// If the branch is removed, a legitimate transient state while editing a
1675
  /// block, any debug-records between those two instructions will not have a
1676
  /// location. Each block thus records any DPValue records that "trail" in
1677
  /// such a way. These are stored in LLVMContext because typically LLVM only
1678
  /// edits a small number of blocks at a time, so there's no need to bloat
1679
  /// BasicBlock with such a data structure.
1680
  SmallDenseMap<BasicBlock *, DPMarker *> TrailingDPValues;
1681
1682
  // Set, get and delete operations for TrailingDPValues.
1683
0
  void setTrailingDPValues(BasicBlock *B, DPMarker *M) {
1684
0
    assert(!TrailingDPValues.count(B));
1685
0
    TrailingDPValues[B] = M;
1686
0
  }
1687
1688
221k
  DPMarker *getTrailingDPValues(BasicBlock *B) {
1689
221k
    return TrailingDPValues.lookup(B);
1690
221k
  }
1691
1692
0
  void deleteTrailingDPValues(BasicBlock *B) {
1693
0
    TrailingDPValues.erase(B);
1694
0
  }
1695
};
1696
1697
} // end namespace llvm
1698
1699
#endif // LLVM_LIB_IR_LLVMCONTEXTIMPL_H