diff --git a/bolt/lib/Profile/DataAggregator.cpp b/bolt/lib/Profile/DataAggregator.cpp --- a/bolt/lib/Profile/DataAggregator.cpp +++ b/bolt/lib/Profile/DataAggregator.cpp @@ -624,6 +624,12 @@ BF.markProfiled(Flags); } + for (auto &FuncBranches : NamesToBranches) + llvm::stable_sort(FuncBranches.second.Data); + + for (auto &MemEvents : NamesToMemEvents) + llvm::stable_sort(MemEvents.second.Data); + // Release intermediate storage. clear(BranchLBRs); clear(FallthroughLBRs); diff --git a/bolt/test/runtime/X86/fdata-escape-chars.ll b/bolt/test/runtime/X86/fdata-escape-chars.ll --- a/bolt/test/runtime/X86/fdata-escape-chars.ll +++ b/bolt/test/runtime/X86/fdata-escape-chars.ll @@ -88,8 +88,8 @@ ; INSTR_CHECK: {{([[:xdigit:]]+)}}: callq "symb whitespace" # Count: 1 ; PREAGR_FDATA_CHECK: 1 main 0 1 static\ symb\ backslash\\/1 0 0 1 -; PREAGR_FDATA_CHECK: 1 main 0 1 symb\ whitespace 0 0 1 ; PREAGR_FDATA_CHECK: 1 main 0 1 symb\ backslash\\ 0 0 2 +; PREAGR_FDATA_CHECK: 1 main 0 1 symb\ whitespace 0 0 1 ; PREAGR_FDATA_CHECK: 1 static\ symb\ backslash\\/1 0 1 symb\ whitespace 0 0 1 ; PREAGR_FDATA_CHECK: 1 symb\ backslash\\ 0 1 symb\ whitespace 0 0 2