[all-commits] [llvm/llvm-project] e2e761: [ADT] Add compact enum table (#202044)
Alexis Engelke via All-commits
all-commits at lists.llvm.org
Fri Jun 26 06:30:09 PDT 2026
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: e2e761203b219a954335ddb6d223b661ff0f5779
https://github.com/llvm/llvm-project/commit/e2e761203b219a954335ddb6d223b661ff0f5779
Author: Alexis Engelke <engelke at in.tum.de>
Date: 2026-06-26 (Fri, 26 Jun 2026)
Changed paths:
A llvm/include/llvm/ADT/Enum.h
M llvm/include/llvm/Support/ScopedPrinter.h
M llvm/unittests/Support/ScopedPrinterTest.cpp
Log Message:
-----------
[ADT] Add compact enum table (#202044)
The existing EnumEntry stores string using StringRefs, which are large
and require two relocations per entry. Introduce a new, compact enum
string representation that stores strings relative to the enum entries
in memory, allowing a low-overhead and relocation-free storage.
Unfortunately, the enum definitions have to be written into a separate
constexpr variable; only C++20 supports structural template parameters.
It is also not possible to hide this behind a macro due, because we want
enum entries to be sourced from other files and #include cannot occur
during a macro expansion.
When all uses of EnumEntry are ported to the new representation, this
will save 4.7k relocations on libLLVM.so (3% in an all-target assert
build), resulting in faster startup and lower max-rss, as these rarely
used pages don't need to be touched at all anymore.
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