[JITLink] Store Sections in a DenseMap with the section name as key.
authorLang Hames <lhames@gmail.com>
Sat, 18 Mar 2023 03:14:11 +0000 (20:14 -0700)
committerLang Hames <lhames@gmail.com>
Sat, 18 Mar 2023 03:21:54 +0000 (20:21 -0700)
commitb5c862e15caf4d8aa34bbc6ee25af8da9a9405a4
tree7149d8a3560385a7162df1d22226063d11fed9ed
parente1f830bde8bad22d375bc92f2084e9055059cc77
[JITLink] Store Sections in a DenseMap with the section name as key.

This speeds up section lookup by name.

This change was motivated by poor performance of a testcase while trying to fix
the NoAlloc lifetime patch that was originally landed as 2cc64df0bd6. The
NoAlloc lifetime patch causes ELF non-SHF_ALLOC sections to be given a JITLink
Section (previously they were skipped), and the
llvm/test/ExecutionEngine/JITLink/X86/ELF_shndex.s testcase creates > 64k
non-SHF_ALLOC sections, each of which now needs to be checked to ensure that its
name does not clash. Moving to a DenseMap allows us to implement this check
efficiently.
llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h
llvm/test/ExecutionEngine/JITLink/X86/COFF_comdat_associative_dead_strip.test