diff --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp index f581529427d7..d082463d34e5 100644 --- a/lld/ELF/Driver.cpp +++ b/lld/ELF/Driver.cpp @@ -1095,7 +1095,7 @@ static void ltoValidateAllVtablesHaveTypeInfos(opt::InputArgList &args) { } static CGProfileSortKind getCGProfileSortKind(opt::InputArgList &args) { - StringRef s = args.getLastArgValue(OPT_call_graph_profile_sort, "cdsort"); + StringRef s = args.getLastArgValue(OPT_call_graph_profile_sort, "hfsort"); if (s == "hfsort") return CGProfileSortKind::Hfsort; if (s == "cdsort") diff --git a/lld/docs/ld.lld.1 b/lld/docs/ld.lld.1 index 12b17dd37796..2e46fc18132f 100644 --- a/lld/docs/ld.lld.1 +++ b/lld/docs/ld.lld.1 @@ -128,9 +128,9 @@ may be: .It Cm none Ignore call graph profile. .It Cm hfsort -Use hfsort. +Use hfsort (default). .It Cm cdsort -Use cdsort (default). +Use cdsort. .El .Pp .It Fl -color-diagnostics Ns = Ns Ar value diff --git a/lld/test/ELF/cgprofile-txt.s b/lld/test/ELF/cgprofile-txt.s index cf5b17627cfb..c9194bbbc43c 100644 --- a/lld/test/ELF/cgprofile-txt.s +++ b/lld/test/ELF/cgprofile-txt.s @@ -26,12 +26,12 @@ # RUN: echo "TooManyPreds10 TooManyPreds 11" >> %t.call_graph # RUN: ld.lld -e A %t --call-graph-ordering-file %t.call_graph --call-graph-profile-sort=hfsort -o %t2 # RUN: llvm-readobj --symbols %t2 | FileCheck %s +## --call-graph-profile-sort=hfsort is the default. +# RUN: ld.lld -e A %t --call-graph-ordering-file %t.call_graph -o %t2b +# RUN: cmp %t2 %t2b # RUN: ld.lld -e A %t --call-graph-ordering-file %t.call_graph --call-graph-profile-sort=cdsort -o %t2 # RUN: llvm-readobj --symbols %t2 | FileCheck %s --check-prefix=CDSORT -## --call-graph-profile-sort=cdsort is the default. -# RUN: ld.lld -e A %t --call-graph-ordering-file %t.call_graph -o %t2b -# RUN: cmp %t2 %t2b # RUN: not ld.lld -e A %t --call-graph-ordering-file %t.call_graph --call-graph-profile-sort=sort \ # RUN: -o /dev/null 2>&1 | FileCheck %s --check-prefix=UNKNOWN