[llvm] [BOLT] Provide backwards compatibility for YAML profile with std::hash (PR #74253)

via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 8 14:57:44 PST 2023


================
@@ -241,12 +241,26 @@ void BinaryFunction::computeBlockHashes() const {
     // Hashing complete instructions.
     std::string InstrHashStr = hashBlock(
         BC, *BB, [&](const MCOperand &Op) { return hashInstOperand(BC, Op); });
-    uint64_t InstrHash = llvm::xxh3_64bits(InstrHashStr);
-    BlendedHashes[I].InstrHash = (uint16_t)InstrHash;
+    if (HashFunction == HashFunction::StdHash) {
+      uint64_t InstrHash = std::hash<std::string>{}(InstrHashStr);
+      BlendedHashes[I].InstrHash = (uint16_t)hash_value(InstrHash);
----------------
spupyrev wrote:

Is `hash_value(x)` stable? Reading the comments, it doesn't seem so

https://github.com/llvm/llvm-project/pull/74253


More information about the llvm-commits mailing list