diff --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp index d082463d34e57..f581529427d7f 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, "hfsort"); + StringRef s = args.getLastArgValue(OPT_call_graph_profile_sort, "cdsort"); if (s == "hfsort") return CGProfileSortKind::Hfsort; if (s == "cdsort") diff --git a/lld/docs/ld.lld.1 b/lld/docs/ld.lld.1 index 2e46fc18132f3..12b17dd37796d 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 (default). +Use hfsort. .It Cm cdsort -Use cdsort. +Use cdsort (default). .El .Pp .It Fl -color-diagnostics Ns = Ns Ar value diff --git a/lld/test/ELF/cgprofile-bad-clusters.s b/lld/test/ELF/cgprofile-bad-clusters.s index c162e981acdd6..0c6068bfc625b 100644 --- a/lld/test/ELF/cgprofile-bad-clusters.s +++ b/lld/test/ELF/cgprofile-bad-clusters.s @@ -10,7 +10,7 @@ # RUN: echo "F G 6" >> %t.call_graph # RUN: echo "G H 5" >> %t.call_graph # RUN: echo "H I 4" >> %t.call_graph -# RUN: ld.lld -e A %t --call-graph-ordering-file %t.call_graph -o %t2 +# 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 .section .text.A,"ax",@progbits diff --git a/lld/test/ELF/cgprofile-icf.s b/lld/test/ELF/cgprofile-icf.s index a9de5613917cb..e28630d0eb30b 100644 --- a/lld/test/ELF/cgprofile-icf.s +++ b/lld/test/ELF/cgprofile-icf.s @@ -5,9 +5,9 @@ # RUN: echo "A B 100" > %t.call_graph # RUN: echo "A C 40" >> %t.call_graph # RUN: echo "C D 61" >> %t.call_graph -# RUN: ld.lld -e A %t --call-graph-ordering-file %t.call_graph -o %t.out -icf=all +# RUN: ld.lld -e A %t --call-graph-ordering-file %t.call_graph --call-graph-profile-sort=hfsort -o %t.out -icf=all # RUN: llvm-readobj --symbols %t.out | FileCheck %s -# RUN: ld.lld -e A %t --call-graph-ordering-file %t.call_graph -o %t2.out +# RUN: ld.lld -e A %t --call-graph-ordering-file %t.call_graph --call-graph-profile-sort=hfsort -o %t2.out # RUN: llvm-readobj --symbols %t2.out | FileCheck %s --check-prefix=NOICF .section .text.D,"ax",@progbits diff --git a/lld/test/ELF/cgprofile-print.s b/lld/test/ELF/cgprofile-print.s index b103ef5109eff..d6f15f2926b57 100644 --- a/lld/test/ELF/cgprofile-print.s +++ b/lld/test/ELF/cgprofile-print.s @@ -5,7 +5,7 @@ # RUN: echo "B C 50" >> %t.call_graph # RUN: echo "C D 40" >> %t.call_graph # RUN: echo "D B 10" >> %t.call_graph -# RUN: ld.lld -e A %t --call-graph-ordering-file %t.call_graph -o %t2 --print-symbol-order=%t3 +# RUN: ld.lld -e A %t --call-graph-ordering-file %t.call_graph -o %t2 --call-graph-profile-sort=hfsort --print-symbol-order=%t3 # RUN: FileCheck %s --input-file %t3 # CHECK: B @@ -32,6 +32,3 @@ C: .globl D D: nop - - - diff --git a/lld/test/ELF/cgprofile-rela.test b/lld/test/ELF/cgprofile-rela.test index 189f169e65481..141dfd4c65b1e 100644 --- a/lld/test/ELF/cgprofile-rela.test +++ b/lld/test/ELF/cgprofile-rela.test @@ -3,7 +3,7 @@ # REQUIRES: x86 # RUN: yaml2obj %s -o %t.o -# RUN: ld.lld %t.o -o %t +# RUN: ld.lld --call-graph-profile-sort=hfsort %t.o -o %t # RUN: llvm-nm --no-sort %t | FileCheck %s # RUN: ld.lld --no-call-graph-profile-sort %t.o -o %t # RUN: llvm-nm --no-sort %t | FileCheck %s --check-prefix=NO-CG diff --git a/lld/test/ELF/cgprofile-reproduce.s b/lld/test/ELF/cgprofile-reproduce.s index b9cb269e4580d..1b1b36151da99 100644 --- a/lld/test/ELF/cgprofile-reproduce.s +++ b/lld/test/ELF/cgprofile-reproduce.s @@ -5,7 +5,7 @@ # RUN: echo "B C 50" >> %t.call_graph # RUN: echo "C D 40" >> %t.call_graph # RUN: echo "D B 10" >> %t.call_graph -# RUN: ld.lld -e A %t --call-graph-ordering-file %t.call_graph -o %t2 --print-symbol-order=%t3 +# RUN: ld.lld -e A %t --call-graph-ordering-file %t.call_graph -o %t2 --call-graph-profile-sort=hfsort --print-symbol-order=%t3 # RUN: ld.lld -e A %t --symbol-ordering-file %t3 -o %t2 # RUN: llvm-readobj --symbols %t2 | FileCheck %s @@ -37,6 +37,3 @@ C: .globl D D: nop - - - diff --git a/lld/test/ELF/cgprofile-txt.s b/lld/test/ELF/cgprofile-txt.s index c9194bbbc43cb..cf5b17627cfb6 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