[lld] [lld][ELF] Sort thunks by their destination to allow quicker convergence (PR #209962)
Arthur Eubanks via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 16 12:53:21 PDT 2026
================
@@ -4107,7 +4084,21 @@ InputSection *ThunkSection::getTargetInputSection() const {
return t->getTargetInputSection();
}
-bool ThunkSection::assignOffsets() {
+bool ThunkSection::assignOffsets(bool sort) {
+ if (sort) {
----------------
aeubanks wrote:
I wonder if we should also sort by short vs long thunks? If we place the long thunks further than short thunks (and make sure to never change a long thunk to a short thunk which could introduce instability) then the short thunks won't increase in range at least due to short -> long thunk upgrade, although we can still get more passes due to the short -> long size increase making other branches through the thunk pool longer.
Maybe not worth the extra complexity, especially since it requires more work on potentially every thunk insertion rather than a one time sort.
https://github.com/llvm/llvm-project/pull/209962
More information about the llvm-commits
mailing list