[all-commits] [llvm/llvm-project] 52d4c5: [Utils] Identity map module-level debug info on fi...

Artem Pianykh via All-commits all-commits at lists.llvm.org
Tue Dec 17 00:59:01 PST 2024


  Branch: refs/heads/users/artempyanykh/fast-coro-upstream/8
  Home:   https://github.com/llvm/llvm-project
  Commit: 52d4c5eb36a1802a615206d471b42bcd5cb10c21
      https://github.com/llvm/llvm-project/commit/52d4c5eb36a1802a615206d471b42bcd5cb10c21
  Author: Artem Pianykh <arr at fb.com>
  Date:   2024-09-15 (Sun, 15 Sep 2024)

  Changed paths:
    M llvm/include/llvm/Transforms/Utils/Cloning.h
    M llvm/include/llvm/Transforms/Utils/ValueMapper.h
    M llvm/lib/Transforms/Utils/CloneFunction.cpp
    M llvm/lib/Transforms/Utils/ValueMapper.cpp

  Log Message:
  -----------
  [Utils] Identity map module-level debug info on first use in CloneFunction*

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

stack-info: PR: https://github.com/llvm/llvm-project/pull/118627, branch: users/artempyanykh/fast-coro-upstream/8



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