[PATCH] D61666: [ELF] Optimize getISDThunkSec() to amortized O(1) in thunk creation

Peter Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 8 02:48:02 PDT 2019


peter.smith added a comment.

If I understand correctly I think this could prematurely skip over ThunkSections if there is more than one branch relocation range. For example consider a case where there are two relocation ranges S (short) and L (long). If we search for a ThunkSection for S where the ThunkSection spacing is L then there is a chance that at a relocation with range S at offset O will be out of range of one of more ThunkSections, but these would have been in range had it been R. The next relocation with range L at offset O2 <https://reviews.llvm.org/owners/package/2/> will not even check some ThunkSections that it would have been in range of. The chances of this happening are much greater when S is much smaller than L.

  Short-branch-needing-thunk
  Long-branch-needing-thunk
  ...
  ThunkSection out of range of short-branch, but in range of long
  ...

I may be missing something though? If I'm right I think that you would need to store a ThunkSecIdx per relocation range for this to give the same results as the existing code. Another possibility is that ThunkSecIdx is only written back to for the largest relocation range.


Repository:
  rLLD LLVM Linker

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D61666/new/

https://reviews.llvm.org/D61666





More information about the llvm-commits mailing list