[all-commits] [llvm/llvm-project] bb7242: [MC] Use StringTable to reduce dynamic relocations...
Reid Kleckner via All-commits
all-commits at lists.llvm.org
Wed Jun 25 05:23:33 PDT 2025
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: bb7242477c2f36195b53018b58a77f1dc12ffb06
https://github.com/llvm/llvm-project/commit/bb7242477c2f36195b53018b58a77f1dc12ffb06
Author: Reid Kleckner <rnk at google.com>
Date: 2025-06-25 (Wed, 25 Jun 2025)
Changed paths:
M llvm/include/llvm/MC/MCSchedule.h
M llvm/lib/MC/MCSchedule.cpp
M llvm/lib/MCA/InstrBuilder.cpp
M llvm/test/TableGen/CompressWriteLatencyEntry.td
M llvm/test/TableGen/InvalidMCSchedClassDesc.td
M llvm/tools/llvm-exegesis/lib/Analysis.cpp
M llvm/utils/TableGen/SubtargetEmitter.cpp
Log Message:
-----------
[MC] Use StringTable to reduce dynamic relocations (#144202)
Dynamic relocations are expensive on ELF/Linux platforms because they
are applied in userspace on process startup. Therefore, it is worth
optimizing them to make PIE and PIC dylib builds faster. In +asserts
builds (non-NDEBUG), nikic identified these schedule class name string
pointers as the leading source of dynamic relocations. [1]
This change uses llvm::StringTable and the StringToOffsetTable TableGen
helper to turn the string pointers into 32-bit offsets into a separate
character array.
The number of dynamic relocations is reduced by ~60%:
❯ llvm-readelf --dyn-relocations lib/libLLVM.so | wc -l
381376 # before
155156 # after
The test suite time is modestly affected, but I'm running on a shared
noisy workstation VM with a ton of cores:
https://gist.github.com/rnk/f38882c2fe2e63d0eb58b8fffeab69de
Testing Time: 100.88s # before
Testing Time: 78.50s. # after
Testing Time: 96.25s. # before again
I haven't used any fancy hyperfine/denoising tools, but I think the
result is clearly visible and we should ship it.
[1] https://gist.github.com/nikic/554f0a544ca15d5219788f1030f78c5a
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list