diff options
author | Mingming Liu <mingmingl@google.com> | 2024-06-26 11:38:20 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-26 11:38:20 -0700 |
commit | 3f78d89a2e6170d206a6b91a93b3fdf5e46ab6db (patch) | |
tree | 08f0c4fde15c3ea7f8cd43fe45ea5d0ab0b25d12 /llvm/tools/llvm-profdata/llvm-profdata.cpp | |
parent | 0f24a462386409c1d907aefb9d8a58481cb71933 (diff) | |
download | llvm-3f78d89a2e6170d206a6b91a93b3fdf5e46ab6db.zip llvm-3f78d89a2e6170d206a6b91a93b3fdf5e46ab6db.tar.gz llvm-3f78d89a2e6170d206a6b91a93b3fdf5e46ab6db.tar.bz2 |
[TypeProf][InstrFDO]Omit vtable symbols in indexed profiles by default (#96520)
- The indexed iFDO profiles contains compressed vtable names for `llvm-profdata show --show-vtables` debugging
usage. An optimized build doesn't need it and doesn't decompress the blob now [1], since optimized binary has the
source code and IR to find vtable symbols.
- The motivation is to avoid increasing profile size when it's not necessary.
- This doesn't change the indexed profile format and thereby doesn't need a version change.
[1] https://github.com/llvm/llvm-project/blob/eac925fb81f26342811ad1765e8f9919628e2254/llvm/include/llvm/ProfileData/InstrProfReader.h#L696-L699
Diffstat (limited to 'llvm/tools/llvm-profdata/llvm-profdata.cpp')
-rw-r--r-- | llvm/tools/llvm-profdata/llvm-profdata.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/llvm/tools/llvm-profdata/llvm-profdata.cpp b/llvm/tools/llvm-profdata/llvm-profdata.cpp index 6c8ab14..2ce0668 100644 --- a/llvm/tools/llvm-profdata/llvm-profdata.cpp +++ b/llvm/tools/llvm-profdata/llvm-profdata.cpp @@ -291,6 +291,11 @@ cl::opt<bool> DropProfileSymbolList( cl::desc("Drop the profile symbol list when merging AutoFDO profiles " "(only meaningful for -sample)")); +cl::opt<bool> KeepVTableSymbols( + "keep-vtable-symbols", cl::init(false), cl::Hidden, + cl::sub(MergeSubcommand), + cl::desc("If true, keep the vtable symbols in indexed profiles")); + // Temporary support for writing the previous version of the format, to enable // some forward compatibility. // TODO: Consider enabling this with future version changes as well, to ease @@ -767,11 +772,12 @@ static void loadInput(const WeightedFile &Input, SymbolRemapper *Remapper, }); } - const InstrProfSymtab &symtab = Reader->getSymtab(); - const auto &VTableNames = symtab.getVTableNames(); + if (KeepVTableSymbols) { + const InstrProfSymtab &symtab = Reader->getSymtab(); + const auto &VTableNames = symtab.getVTableNames(); - for (const auto &kv : VTableNames) { - WC->Writer.addVTableName(kv.getKey()); + for (const auto &kv : VTableNames) + WC->Writer.addVTableName(kv.getKey()); } if (Reader->hasTemporalProfile()) { |