Skip to content

Commit

Permalink
Add a comment on partial hashing of Metadata
Browse files Browse the repository at this point in the history
Following r263866, on D. Blaikie suggestion.

From: Mehdi Amini <[email protected]>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@263869 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
joker-eph committed Mar 19, 2016
1 parent bccbdac commit 991382f
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions lib/IR/LLVMContextImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
};
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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);
}
};
Expand Down

0 comments on commit 991382f

Please sign in to comment.