Skip to content

Commit 93fd72c

Browse files
authored
[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.
1 parent ecf264d commit 93fd72c

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

llvm/lib/DebugInfo/GSYM/GsymCreator.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -275,8 +275,9 @@ llvm::Error GsymCreator::finalize(OutputAggregator &Out) {
275275
// object.
276276
if (!IsSegment) {
277277
if (NumBefore > 1) {
278-
// Sort function infos so we can emit sorted functions.
279-
llvm::sort(Funcs);
278+
// Sort function infos so we can emit sorted functions. Use stable sort to
279+
// ensure determinism.
280+
llvm::stable_sort(Funcs);
280281
std::vector<FunctionInfo> FinalizedFuncs;
281282
FinalizedFuncs.reserve(Funcs.size());
282283
FinalizedFuncs.emplace_back(std::move(Funcs.front()));

0 commit comments

Comments
 (0)