[all-commits] [llvm/llvm-project] e0612c: [ELF] Optimize getInputSections. NFC

Fangrui Song via All-commits all-commits at lists.llvm.org
Tue Jul 5 23:31:26 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e0612c91cd16596ffa307952b1a8345c145f9326
      https://github.com/llvm/llvm-project/commit/e0612c91cd16596ffa307952b1a8345c145f9326
  Author: Fangrui Song <i at maskray.me>
  Date:   2022-07-05 (Tue, 05 Jul 2022)

  Changed paths:
    M lld/ELF/OutputSections.cpp
    M lld/ELF/OutputSections.h
    M lld/ELF/Writer.cpp

  Log Message:
  -----------
  [ELF] Optimize getInputSections. NFC

In the majority of cases (e.g. orphan sections), an OutputSection has at most
one InputSectionDescription (isd). By changing the return type to
ArrayRef<InputSection *> we can just reference the isd->sections. For
OutputSections with more than one InputSectionDescription we use a caller
provided SmallVector to copy the elements as before.

Reviewed By: peter.smith

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




More information about the All-commits mailing list