diff options
author | Artem Pianykh <artem.pyanykh@gmail.com> | 2025-01-24 08:38:38 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-01-24 08:38:38 +0000 |
commit | 196f7c2a4f472074668451c5ecc40e82731940f7 (patch) | |
tree | 015a8120b50638ae86ea99621416b6ce7ced65db /llvm/lib/CodeGen/CodeGenTargetMachineImpl.cpp | |
parent | 24e70e3930724ce499ad05d669bfbc4423c542e0 (diff) | |
download | llvm-196f7c2a4f472074668451c5ecc40e82731940f7.zip llvm-196f7c2a4f472074668451c5ecc40e82731940f7.tar.gz llvm-196f7c2a4f472074668451c5ecc40e82731940f7.tar.bz2 |
[Utils] Identity map module-level debug info on first use in CloneFunction* (#118627)
Summary:
To avoid cloning module-level debug info (owned by the module rather
than the function), CloneFunction implementation used to eagerly
identity map such debug info into ValueMap's MD map. In larger modules
with meaningful volume of debug info this gets very expensive.
By passing such debug info metadata via an IdentityMD set for the
ValueMapper to map on first use, we get several benefits:
1. Mapping metadata is not cheap, particularly because of tracking. When
cloning a Function we identity map lots of global module-level
metadata to avoid cloning it, while only a fraction of it is actually
used by the function. Mapping on first use is a lot faster for
modules with meaningful amount of debug info.
2. Eagerly identity mapping metadata makes it harder to cache
module-level data (e.g. a set of metadata nodes in a \a DICompileUnit).
With this patch we can cache certain module-level metadata
calculations to speed things up further.
Anecdata from compiling a sample cpp file with full debug info shows that this moderately speeds up
CoroSplitPass which is one of the heavier users of cloning:
| | Baseline | IdentityMD set |
|-----------------|----------|----------------|
| CoroSplitPass | 306ms | 221ms |
| CoroCloner | 101ms | 72ms |
| Speed up | 1x | 1.4x |
Test Plan:
ninja check-llvm-unit
ninja check-llvm
Diffstat (limited to 'llvm/lib/CodeGen/CodeGenTargetMachineImpl.cpp')
0 files changed, 0 insertions, 0 deletions