[all-commits] [llvm/llvm-project] 95795a: Linker: Remove dropTriviallyDeadConstantArrays().

Peter Collingbourne via All-commits all-commits at lists.llvm.org
Mon Apr 28 12:24:03 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 95795ab7dc3029e64e0a0a7893b95f4bfab667f1
      https://github.com/llvm/llvm-project/commit/95795ab7dc3029e64e0a0a7893b95f4bfab667f1
  Author: Peter Collingbourne <peter at pcc.me.uk>
  Date:   2025-04-28 (Mon, 28 Apr 2025)

  Changed paths:
    M llvm/include/llvm/IR/Module.h
    M llvm/lib/IR/LLVMContextImpl.cpp
    M llvm/lib/IR/LLVMContextImpl.h
    M llvm/lib/Linker/IRMover.cpp

  Log Message:
  -----------
  Linker: Remove dropTriviallyDeadConstantArrays().

By calling this function after every link, we introduce quadratic
behavior during full LTO links that primarily affects links involving
large numbers of constant arrays, such as the full LTO part of a
ThinLTO link which will involve large numbers of vtable constants.
Removing this call resulted in a 1.3x speedup in the indexing phase
of a large internal Google binary.

This call was originally introduced to reduce memory consumption during
full LTO (see commit dab999d54f39af3ebb6a23e850dbc9742016fac8), but it
doesn't seem to be the case that this helps any more. I ran 3 stage2
links of clang with full LTO and ThinLTO with and without this change
and measured the max RSS. The results were as follows (all in KB):

```
FullLTO before 22362512 22383524 22387456
         after 22383496 22365356 22364352
ThinLTO before  4391404  4478192  4383468
         after  4399220  4363100  4417688
```

As you can see, any max RSS differences are in the noise.

Reviewers: nikic, teresajohnson

Reviewed By: teresajohnson, nikic

Pull Request: https://github.com/llvm/llvm-project/pull/137081



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