[spirv] Improve the hashing function for function type.

This commit is contained in:
Ehsan Nasiri 2018-12-17 14:16:35 -05:00 коммит произвёл Ehsan
Родитель 21b82e4e51
Коммит b486eb362b
1 изменённых файлов: 5 добавлений и 2 удалений

Просмотреть файл

@ -98,8 +98,11 @@ struct FunctionTypeMapInfo {
static inline FunctionType *getTombstoneKey() { return nullptr; }
static unsigned getHashValue(const FunctionType *Val) {
// Hashing based on return type and number of function parameters.
return llvm::hash_combine(Val->getReturnType(),
Val->getParamTypes().size());
auto hashCode =
llvm::hash_combine(Val->getReturnType(), Val->getParamTypes().size());
for (const SpirvType *paramType : Val->getParamTypes())
hashCode = llvm::hash_combine(hashCode, paramType);
return hashCode;
}
static bool isEqual(const FunctionType *LHS, const FunctionType *RHS) {
// Either both are null, or both should have the same underlying type.