[all-commits] [llvm/llvm-project] e1b6b5: [ELF] Avoid referencing SectionBase::repl after ICF

Fangrui Song via All-commits all-commits at lists.llvm.org
Fri Dec 24 12:10:00 PST 2021

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e1b6b5be462ee2f197737162fc2a7d23e9a2eab6
  Author: Fangrui Song <i at maskray.me>
  Date:   2021-12-24 (Fri, 24 Dec 2021)

  Changed paths:
    M lld/ELF/CallGraphSort.cpp
    M lld/ELF/ICF.cpp
    M lld/ELF/InputSection.cpp
    M lld/ELF/InputSection.h
    M lld/ELF/Relocations.cpp
    M lld/ELF/Symbols.cpp
    M lld/ELF/Symbols.h
    M lld/ELF/SyntheticSections.cpp
    M lld/ELF/Writer.cpp

  Log Message:
  [ELF] Avoid referencing SectionBase::repl after ICF

It is fairly easy to forget SectionBase::repl after ICF.
Let ICF rewrite a Defined symbol's `section` field to avoid references to
SectionBase::repl in subsequent passes. This slightly improves the --icf=none
performance due to less indirection (maybe for --icf={safe,all} as well if most
symbols are Defined).

With this change, there is only one reference to `repl` (--gdb-index D89751).
We can undo f4fb5fd7523f8e3c3b3966d43c0a28457b59d1d8 (`Move Repl to SectionBase.`)
but move `repl` to `InputSection` instead.

Reviewed By: ikudrin

Differential Revision: https://reviews.llvm.org/D116093

More information about the All-commits mailing list