aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib
diff options
context:
space:
mode:
authoralx32 <103613512+alx32@users.noreply.github.com>2025-01-14 13:07:16 -0800
committerGitHub <noreply@github.com>2025-01-14 13:07:16 -0800
commit93fd72cbb1a3c340add27fc380c4450406313d68 (patch)
tree557bfdfd91280cc457f1d17abea992c1044a4a6a /llvm/lib
parentecf264d3b4eebcfcc3bd89ceac090b82fd5e75c7 (diff)
downloadllvm-93fd72cbb1a3c340add27fc380c4450406313d68.zip
llvm-93fd72cbb1a3c340add27fc380c4450406313d68.tar.gz
llvm-93fd72cbb1a3c340add27fc380c4450406313d68.tar.bz2
[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.
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/DebugInfo/GSYM/GsymCreator.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/DebugInfo/GSYM/GsymCreator.cpp b/llvm/lib/DebugInfo/GSYM/GsymCreator.cpp
index 14078f5..93ff3b9 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()));