[DebugInstrRef] Use DenseMap for ValueToLoc (NFC)
Just replacing std::map with DenseMap here is a major regression -- because this code used an identity hash for ValueIDNum. Because ValueIDNum is composed of multiple components, it is important that we use a reasonably good hash function here, so switch it to hash_value. DenseMapInfo::getHashValue<uint64_t> would not be sufficient. This gives a -0.8% geomean improvement on CTMark ReleaseLTO-g.
This commit is contained in:
parent
4afa9c1726
commit
cbaae61422
|
@ -272,7 +272,7 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
// Map of the preferred location for each value.
|
// Map of the preferred location for each value.
|
||||||
std::map<ValueIDNum, LocIdx> ValueToLoc;
|
DenseMap<ValueIDNum, LocIdx> ValueToLoc;
|
||||||
ActiveMLocs.reserve(VLocs.size());
|
ActiveMLocs.reserve(VLocs.size());
|
||||||
ActiveVLocs.reserve(VLocs.size());
|
ActiveVLocs.reserve(VLocs.size());
|
||||||
|
|
||||||
|
|
|
@ -1082,7 +1082,9 @@ template <> struct DenseMapInfo<ValueIDNum> {
|
||||||
return ValueIDNum::TombstoneValue;
|
return ValueIDNum::TombstoneValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned getHashValue(const ValueIDNum &Val) { return Val.asU64(); }
|
static unsigned getHashValue(const ValueIDNum &Val) {
|
||||||
|
return hash_value(Val.asU64());
|
||||||
|
}
|
||||||
|
|
||||||
static bool isEqual(const ValueIDNum &A, const ValueIDNum &B) {
|
static bool isEqual(const ValueIDNum &A, const ValueIDNum &B) {
|
||||||
return A == B;
|
return A == B;
|
||||||
|
|
Loading…
Reference in New Issue