[llvm] 93fd72c - [llvm-gsymutil] Ensure gSYM creation determinism with merged functions (#122921)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 14 13:07:19 PST 2025
Author: alx32
Date: 2025-01-14T13:07:16-08:00
New Revision: 93fd72cbb1a3c340add27fc380c4450406313d68
URL: https://github.com/llvm/llvm-project/commit/93fd72cbb1a3c340add27fc380c4450406313d68
DIFF: https://github.com/llvm/llvm-project/commit/93fd72cbb1a3c340add27fc380c4450406313d68.diff
LOG: [llvm-gsymutil] Ensure gSYM creation determinism with merged functions (#122921)
We were seeing occasional test failures with expensive checks enabled.
The issue was tracked down to a `sort` which should instead be a
`stable_sort` to ensure determinism. Checked locally and the
non-determinism went away.
Added:
Modified:
llvm/lib/DebugInfo/GSYM/GsymCreator.cpp
Removed:
################################################################################
diff --git a/llvm/lib/DebugInfo/GSYM/GsymCreator.cpp b/llvm/lib/DebugInfo/GSYM/GsymCreator.cpp
index 14078f5aaf9a46..93ff3b924db324 100644
--- a/llvm/lib/DebugInfo/GSYM/GsymCreator.cpp
+++ b/llvm/lib/DebugInfo/GSYM/GsymCreator.cpp
@@ -275,8 +275,9 @@ llvm::Error GsymCreator::finalize(OutputAggregator &Out) {
// object.
if (!IsSegment) {
if (NumBefore > 1) {
- // Sort function infos so we can emit sorted functions.
- llvm::sort(Funcs);
+ // Sort function infos so we can emit sorted functions. Use stable sort to
+ // ensure determinism.
+ llvm::stable_sort(Funcs);
std::vector<FunctionInfo> FinalizedFuncs;
FinalizedFuncs.reserve(Funcs.size());
FinalizedFuncs.emplace_back(std::move(Funcs.front()));
More information about the llvm-commits
mailing list