[all-commits] [llvm/llvm-project] 65e57b: [FunctionImport] Reduce string duplication (NFC)
Teresa Johnson via All-commits
all-commits at lists.llvm.org
Fri Aug 4 14:43:31 PDT 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 65e57bbed06d55cab7bb64d54891d33ccb2d4159
https://github.com/llvm/llvm-project/commit/65e57bbed06d55cab7bb64d54891d33ccb2d4159
Author: Teresa Johnson <tejohnson at google.com>
Date: 2023-08-04 (Fri, 04 Aug 2023)
Changed paths:
M clang/lib/CodeGen/BackendUtil.cpp
M llvm/include/llvm/LTO/LTO.h
M llvm/include/llvm/Transforms/IPO/FunctionImport.h
M llvm/lib/LTO/LTO.cpp
M llvm/lib/LTO/ThinLTOCodeGenerator.cpp
M llvm/lib/Transforms/IPO/FunctionImport.cpp
M llvm/tools/llvm-link/llvm-link.cpp
Log Message:
-----------
[FunctionImport] Reduce string duplication (NFC)
The import/export maps, and the ModuleToDefinedGVSummaries map, are all
indexed by module paths, which are StringRef obtained from the module
summary index, which already has a data structure than owns these
strings (the ModulePathStringTable). Because these other maps are also
StringMap, which makes a copy of the string key, we were keeping
multiple extra copies of the module paths, leading to memory overhead.
Change these to DenseMap keyed by StringRef, and document that the
strings are owned by the index.
The only exception is the llvm-link tool which synthesizes an import list
from command line options, and I have added a string cache to maintain
ownership there.
I measured around 5% memory reduction in the thin link of a large
binary.
Differential Revision: https://reviews.llvm.org/D156580
More information about the All-commits
mailing list