Add a comment on partial hashing of Metadata

Following r263866, on D. Blaikie suggestion.

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 263869
This commit is contained in:
Mehdi Amini 2016-03-19 01:06:24 +00:00
parent 2cf9082831
commit 9bc362a215
1 changed files with 12 additions and 0 deletions

View File

@ -365,6 +365,10 @@ template <> struct MDNodeKeyImpl<DIDerivedType> {
ExtraData == RHS->getRawExtraData();
}
unsigned getHashValue() const {
// Intentionally computes the hash on a subset of the operands for
// performance reason. The subset has to be significant enough to avoid
// collision "most of the time". There is no correctness issue in case of
// collision because of the full check above.
return hash_combine(Tag, Name, File, Line, Scope, BaseType, Flags);
}
};
@ -421,6 +425,10 @@ template <> struct MDNodeKeyImpl<DICompositeType> {
Identifier == RHS->getRawIdentifier();
}
unsigned getHashValue() const {
// Intentionally computes the hash on a subset of the operands for
// performance reason. The subset has to be significant enough to avoid
// collision "most of the time". There is no correctness issue in case of
// collision because of the full check above.
return hash_combine(Name, File, Line, BaseType, Scope, Elements,
TemplateParams);
}
@ -517,6 +525,10 @@ template <> struct MDNodeKeyImpl<DISubprogram> {
Variables == RHS->getRawVariables();
}
unsigned getHashValue() const {
// Intentionally computes the hash on a subset of the operands for
// performance reason. The subset has to be significant enough to avoid
// collision "most of the time". There is no correctness issue in case of
// collision because of the full check above.
return hash_combine(Name, Scope, File, Type, Line);
}
};