summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorMehdi Amini <mehdi.amini@apple.com>2016-03-19 01:06:24 +0000
committerMehdi Amini <mehdi.amini@apple.com>2016-03-19 01:06:24 +0000
commit9bc362a21510fecaa495578886f2868011eb66f3 (patch)
tree022d23694de98d25dc8f2ee72d77ade8c674c91d /llvm/lib
parent2cf90828316a9fbe92dbdd65991c9a3f3ba974ba (diff)
downloadbcm5719-llvm-9bc362a21510fecaa495578886f2868011eb66f3.tar.gz
bcm5719-llvm-9bc362a21510fecaa495578886f2868011eb66f3.zip
Add a comment on partial hashing of Metadata
Following r263866, on D. Blaikie suggestion. From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 263869
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/IR/LLVMContextImpl.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/llvm/lib/IR/LLVMContextImpl.h b/llvm/lib/IR/LLVMContextImpl.h
index c420690d7bd..56621e064d8 100644
--- a/llvm/lib/IR/LLVMContextImpl.h
+++ b/llvm/lib/IR/LLVMContextImpl.h
@@ -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);
}
};
OpenPOWER on IntegriCloud