[PATCH] D155764: [BOLT][DWARF] Replace MD5 with hash_combine

Alexander Yermolovich via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 20 11:51:39 PDT 2023


This revision was automatically updated to reflect the committed changes.
Closed by commit rGf52e61f3d37b: [BOLT][DWARF] Replace MD5 with hash_combine (authored by ayermolo).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D155764/new/

https://reviews.llvm.org/D155764

Files:
  bolt/lib/Core/DIEBuilder.cpp


Index: bolt/lib/Core/DIEBuilder.cpp
===================================================================
--- bolt/lib/Core/DIEBuilder.cpp
+++ bolt/lib/Core/DIEBuilder.cpp
@@ -838,12 +838,11 @@
   // Before DWARF5 TU units are in their own section, so at least one offset,
   // first one, will be the same as CUs in .debug_info.dwo section
   if (DU.getVersion() < 5 && DU.isTypeUnit()) {
-    MD5 Hash;
-    uint64_t TypeUnitHash = cast_or_null<DWARFTypeUnit>(&DU)->getTypeHash();
-    uint64_t Offset = DU.getOffset();
-    Hash.update(llvm::ArrayRef((uint8_t *)&TypeUnitHash, sizeof(TypeUnitHash)));
-    Hash.update(llvm::ArrayRef((uint8_t *)&Offset, sizeof(Offset)));
-    return Hash.final().high();
+    const uint64_t TypeUnitHash =
+        cast_or_null<DWARFTypeUnit>(&DU)->getTypeHash();
+    const uint64_t Offset = DU.getOffset();
+    return llvm::hash_combine(llvm::hash_value(TypeUnitHash),
+                              llvm::hash_value(Offset));
   }
   return DU.getOffset();
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D155764.542624.patch
Type: text/x-patch
Size: 998 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230720/2e87f760/attachment.bin>


More information about the llvm-commits mailing list