[llvm] 099f4e2 - [llvm-debuginfod] Switch to xxh3_64bits
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 11 12:37:23 PDT 2023
Author: Fangrui Song
Date: 2023-08-11T12:37:18-07:00
New Revision: 099f4e236c24ad42e56a6811e0ea4ed54ca00906
URL: https://github.com/llvm/llvm-project/commit/099f4e236c24ad42e56a6811e0ea4ed54ca00906
DIFF: https://github.com/llvm/llvm-project/commit/099f4e236c24ad42e56a6811e0ea4ed54ca00906.diff
LOG: [llvm-debuginfod] Switch to xxh3_64bits
Many sources show that xxh3 is much better than xxh64. This particular
instance may or may not have noticeable difference, but this change
moves us toward removing xxHash64.
This change will invalid cache.
Reviewed By: mysterymath
Differential Revision: https://reviews.llvm.org/D155993
Added:
Modified:
llvm/lib/Debuginfod/Debuginfod.cpp
llvm/test/tools/llvm-debuginfod-find/cache.test
llvm/test/tools/llvm-objdump/debuginfod.test
llvm/test/tools/llvm-symbolizer/debuginfod.test
Removed:
################################################################################
diff --git a/llvm/lib/Debuginfod/Debuginfod.cpp b/llvm/lib/Debuginfod/Debuginfod.cpp
index 394f2b29aee651..fa4c1a0499f059 100644
--- a/llvm/lib/Debuginfod/Debuginfod.cpp
+++ b/llvm/lib/Debuginfod/Debuginfod.cpp
@@ -47,7 +47,9 @@ namespace llvm {
using llvm::object::BuildIDRef;
-static std::string uniqueKey(llvm::StringRef S) { return utostr(xxHash64(S)); }
+static std::string uniqueKey(llvm::StringRef S) {
+ return utostr(xxh3_64bits(S));
+}
// Returns a binary BuildID as a normalized hex string.
// Uses lowercase for compatibility with common debuginfod servers.
diff --git a/llvm/test/tools/llvm-debuginfod-find/cache.test b/llvm/test/tools/llvm-debuginfod-find/cache.test
index 28359b45220b30..eae341f3eb299c 100644
--- a/llvm/test/tools/llvm-debuginfod-find/cache.test
+++ b/llvm/test/tools/llvm-debuginfod-find/cache.test
@@ -27,12 +27,12 @@ RUN: DEBUGINFOD_CACHE_PATH=%t/cache DEBUGINFOD_URLS=file://%t \
RUN: llvm-debuginfod-find --debuginfo 0123456789012346 > /dev/null
RUN: ls %t/cache | FileCheck --check-prefix=BOTH --match-full-lines --implicit-check-not {{.}} %s
-FIRST: llvmcache-6663022027345102449
+FIRST: llvmcache-10846399329613630737
FIRST: llvmcache.timestamp
-SECOND: llvmcache-6762748755046480574
+SECOND: llvmcache-10192351353398627645
SECOND: llvmcache.timestamp
-BOTH: llvmcache-6663022027345102449
-BOTH: llvmcache-6762748755046480574
+BOTH: llvmcache-10192351353398627645
+BOTH: llvmcache-10846399329613630737
BOTH: llvmcache.timestamp
diff --git a/llvm/test/tools/llvm-objdump/debuginfod.test b/llvm/test/tools/llvm-objdump/debuginfod.test
index a2ef5a9d2c2d7a..390916974598fd 100644
--- a/llvm/test/tools/llvm-objdump/debuginfod.test
+++ b/llvm/test/tools/llvm-objdump/debuginfod.test
@@ -15,15 +15,15 @@ RUN: FileCheck %s --check-prefix=NOTFOUND
# Use cp to write the debug binary to an appropriately-named file in the llvm
# debuginfod cache.
-RUN: cp %p/Inputs/embedded-source %t/llvmcache-7361776989772977641
+RUN: cp %p/Inputs/embedded-source %t/llvmcache-17908201640401622315
# Write a broken "binary" under %t/broken.
RUN: mkdir %t/broken
-RUN: echo "bad" > %t/broken/llvmcache-7361776989772977641
+RUN: echo "bad" > %t/broken/llvmcache-17908201640401622315
# Write the stripped binary under %t/stripped-cache.
RUN: mkdir %t/stripped-cache
-RUN: cp %t/stripped %t/stripped-cache/llvmcache-7361776989772977641
+RUN: cp %t/stripped %t/stripped-cache/llvmcache-17908201640401622315
# Write to a debug info directory as well.
RUN: mkdir -p %t/debug/.build-id/15
@@ -53,7 +53,7 @@ RUN: env DEBUGINFOD_CACHE_PATH=%t/broken llvm-objdump -d --source --debuginfod \
RUN: %t/stripped 2> %t.err | \
RUN: FileCheck %s --check-prefix=NOTFOUND
RUN: FileCheck %s --check-prefix=BADBINARYERROR -DPATH=%t --input-file %t.err
-BADBINARYERROR: warning: '[[PATH]]/broken{{[/\\]}}llvmcache-7361776989772977641': The file was not recognized as a valid object file
+BADBINARYERROR: warning: '[[PATH]]/broken{{[/\\]}}llvmcache-17908201640401622315': The file was not recognized as a valid object file
# Use the original binary if the fetched binary has no debug info.
RUN: env DEBUGINFOD_CACHE_PATH=%t/stripped-cache llvm-objdump -d --source \
@@ -86,8 +86,8 @@ RUN: FileCheck %s --check-prefix=SYMBOLS
# Use debuginfod to recover section headers, but not symbols.
RUN: mkdir %t/stripped-symbols
-RUN: cp %p/Inputs/embedded-source %t/stripped-symbols/llvmcache-7361776989772977641
-RUN: llvm-strip %t/stripped-symbols/llvmcache-7361776989772977641
+RUN: cp %p/Inputs/embedded-source %t/stripped-symbols/llvmcache-17908201640401622315
+RUN: llvm-strip %t/stripped-symbols/llvmcache-17908201640401622315
RUN: env DEBUGINFOD_CACHE_PATH=%t/stripped-symbols llvm-objdump -d \
RUN: --debuginfod %t/stripped | \
RUN: FileCheck %s --check-prefix=SECTIONS
@@ -95,8 +95,8 @@ RUN: FileCheck %s --check-prefix=SECTIONS
# Don't use debuginfod if neither section headers nor symbols can be recovered.
RUN: mkdir %t/stripped-sections
RUN: echo "" | llvm-mc -filetype=obj -triple x86_64 > \
-RUN: %t/stripped-sections/llvmcache-7361776989772977641
-RUN: llvm-strip --strip-sections %t/stripped-sections/llvmcache-7361776989772977641
+RUN: %t/stripped-sections/llvmcache-17908201640401622315
+RUN: llvm-strip --strip-sections %t/stripped-sections/llvmcache-17908201640401622315
RUN: env DEBUGINFOD_CACHE_PATH=%t/stripped-sections llvm-objdump -d \
RUN: --debuginfod %t/stripped | \
RUN: FileCheck %s --check-prefix=NOSECTIONS
diff --git a/llvm/test/tools/llvm-symbolizer/debuginfod.test b/llvm/test/tools/llvm-symbolizer/debuginfod.test
index a9b984aad7b05b..98559077cfe057 100644
--- a/llvm/test/tools/llvm-symbolizer/debuginfod.test
+++ b/llvm/test/tools/llvm-symbolizer/debuginfod.test
@@ -16,9 +16,9 @@ NOTFOUND-NEXT: ??:0:0
# Use llvm-objcopy to write the debuginfo of the addr.exe binary to an
# appropriately-named file in the llvm debuginfod cache. The filename is
# determined by the debuginfod client's caching scheme, so it is manually
-# specified here as llvmcache-98...19
+# specified here as llvmcache-\d+
RUN: llvm-objcopy --keep-section=.debug_info %p/Inputs/addr.exe \
-RUN: %t/llvmcache-9800707741016212219
+RUN: %t/llvmcache-1165050469834211050
# The symbolizer should call the debuginfod client library, which finds the
# debuginfo placed in the cache, enabling symbolization of the address.
More information about the llvm-commits
mailing list