[lld] [ELF] Making cdsort default for function reordering (PR #68638)

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


MaskRay wrote:

> If cdsort is better, after some baking period we should probably remove other alternative call graph layout algorithm (hfsort) in the code base just to keep things simple.

I am afraid we cannot remove hfsort as the high time complexity of cache-directed sort is a real issue.
In a not-so-large executable, CodeLayout.cpp took 20+ minutes, which is not acceptable. I'm sorry but I'll revert this patch as the cdsort default is too risky now. I'm happy to make more investigation and try making CodeLayout.cpp faster.

```
   4.6%  20.7Mi    .text.hot
   3.5%  15.9Mi    .text
   3.4%  15.2Mi    .text.unknown
   2.8%  12.7Mi    .debug_rnglists
   2.0%  8.88Mi    .rela.dyn
   1.3%  6.09Mi    .symtab
   1.3%  5.72Mi    .rodata
   1.2%  5.58Mi    [54 Others]
```

https://github.com/llvm/llvm-project/pull/68638


More information about the llvm-commits mailing list