[rebranch] Do not serialize unstable hashes

https://github.com/llvm/llvm-project/pull/96282 changed
`get_execution_seed` to be non-deterministic. Use stable hashes instead.
This commit is contained in:
Ben Barham
2024-07-31 20:17:06 -07:00
parent 0a6e5874e2
commit cfbc007535
6 changed files with 10 additions and 10 deletions

View File

@@ -69,7 +69,7 @@ public:
using hash_value_type = uint32_t;
using offset_type = uint32_t;
hash_value_type ComputeHash(key_type_ref key) { return llvm::hash_code(key); }
hash_value_type ComputeHash(key_type_ref key) { return key; }
std::pair<offset_type, offset_type> EmitKeyDataLength(llvm::raw_ostream &out,
key_type_ref key,
@@ -113,7 +113,7 @@ public:
}
hash_value_type ComputeHash(internal_key_type key) {
return llvm::hash_code(key);
return key;
}
static std::pair<offset_type, offset_type>

View File

@@ -1142,7 +1142,7 @@ namespace {
}
hash_value_type ComputeHash(key_type_ref key) {
return llvm::DenseMapInfo<SerializedSwiftName>::getHashValue(key);
return static_cast<unsigned>(key.Kind) + llvm::djbHash(key.Name);
}
std::pair<unsigned, unsigned> EmitKeyDataLength(raw_ostream &out,
@@ -1421,7 +1421,7 @@ namespace {
}
hash_value_type ComputeHash(internal_key_type key) {
return llvm::DenseMapInfo<SerializedSwiftName>::getHashValue(key);
return static_cast<unsigned>(key.Kind) + llvm::djbHash(key.Name);
}
static bool EqualKey(internal_key_type lhs, internal_key_type rhs) {

View File

@@ -283,7 +283,7 @@ const uint16_t SWIFT_LOOKUP_TABLE_VERSION_MAJOR = 1;
/// Lookup table minor version number.
///
/// When the format changes IN ANY WAY, this number should be incremented.
const uint16_t SWIFT_LOOKUP_TABLE_VERSION_MINOR = 19; // 64-bit clang serialization IDs
const uint16_t SWIFT_LOOKUP_TABLE_VERSION_MINOR = 20; // hash functions
/// A lookup table that maps Swift names to the set of Clang

View File

@@ -318,7 +318,7 @@ public:
}
hash_value_type ComputeHash(internal_key_type key) {
return llvm::hash_value(key);
return key;
}
static bool EqualKey(internal_key_type lhs, internal_key_type rhs) {
@@ -557,7 +557,7 @@ public:
internal_key_type GetInternalKey(external_key_type ID) { return ID; }
hash_value_type ComputeHash(internal_key_type key) {
return llvm::hash_value(key);
return key;
}
static bool EqualKey(internal_key_type lhs, internal_key_type rhs) {

View File

@@ -58,7 +58,7 @@ const uint16_t SWIFTMODULE_VERSION_MAJOR = 0;
/// describe what change you made. The content of this comment isn't important;
/// it just ensures a conflict if two people change the module format.
/// Don't worry about adhering to the 80-column limit for this line.
const uint16_t SWIFTMODULE_VERSION_MINOR = 881; // Changes to LifetimeDependence
const uint16_t SWIFTMODULE_VERSION_MINOR = 882; // hash functions
/// A standard hash seed used for all string hashes in a serialized module.
///

View File

@@ -414,7 +414,7 @@ namespace {
using offset_type = unsigned;
hash_value_type ComputeHash(key_type_ref key) {
return llvm::hash_value(static_cast<uint32_t>(key));
return static_cast<uint32_t>(key);
}
std::pair<unsigned, unsigned> EmitKeyDataLength(raw_ostream &out,
@@ -459,7 +459,7 @@ namespace {
using offset_type = unsigned;
hash_value_type ComputeHash(key_type_ref key) {
return llvm::hash_value(static_cast<uint32_t>(key));
return static_cast<uint32_t>(key);
}
std::pair<unsigned, unsigned>