[lld] 60b3e05 - [ELF] Restore the --call-graph-profile-sort=hfsort default before #68638

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 12 22:58:48 PDT 2023


Author: Fangrui Song
Date: 2023-10-12T22:58:42-07:00
New Revision: 60b3e05967ff5f6cbb7b9dea32395ed0799f3bdd

URL: https://github.com/llvm/llvm-project/commit/60b3e05967ff5f6cbb7b9dea32395ed0799f3bdd
DIFF: https://github.com/llvm/llvm-project/commit/60b3e05967ff5f6cbb7b9dea32395ed0799f3bdd.diff

LOG: [ELF] Restore the --call-graph-profile-sort=hfsort default before #68638

The high time complexity of cache-directed sort is a real issue and is not
appropriate as the default, at least for now
(https://github.com/llvm/llvm-project/pull/68638#issuecomment-1760918891).

Added: 
    

Modified: 
    lld/ELF/Driver.cpp
    lld/docs/ld.lld.1
    lld/test/ELF/cgprofile-txt.s

Removed: 
    


################################################################################
diff  --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp
index f581529427d7f43..d082463d34e576c 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 12b17dd37796d13..2e46fc18132f3e0 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 cf5b17627cfb63c..c9194bbbc43cbe0 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


        


More information about the llvm-commits mailing list