[llvm] r263869 - Add a comment on partial hashing of Metadata
Mehdi Amini via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 18 18:06:24 PDT 2016
Author: mehdi_amini
Date: Fri Mar 18 20:06:24 2016
New Revision: 263869
URL: http://llvm.org/viewvc/llvm-project?rev=263869&view=rev
Log:
Add a comment on partial hashing of Metadata
Following r263866, on D. Blaikie suggestion.
From: Mehdi Amini <mehdi.amini at apple.com>
Modified:
llvm/trunk/lib/IR/LLVMContextImpl.h
Modified: llvm/trunk/lib/IR/LLVMContextImpl.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/LLVMContextImpl.h?rev=263869&r1=263868&r2=263869&view=diff
==============================================================================
--- llvm/trunk/lib/IR/LLVMContextImpl.h (original)
+++ llvm/trunk/lib/IR/LLVMContextImpl.h Fri Mar 18 20:06:24 2016
@@ -365,6 +365,10 @@ template <> struct MDNodeKeyImpl<DIDeriv
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<DICompo
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<DISubpr
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);
}
};
More information about the llvm-commits
mailing list