[all-commits] [llvm/llvm-project] 4cb016: [X86][ELF] Prefer lowering MC_GlobalAddress operan...

bd1976bris via All-commits all-commits at lists.llvm.org
Thu Aug 13 16:09:40 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 4cb016cd2d8467c572b2e5c5d34f376ee79e4ac1
      https://github.com/llvm/llvm-project/commit/4cb016cd2d8467c572b2e5c5d34f376ee79e4ac1
  Author: Ben Dunbobbin <Ben.Dunbobbin at sony.com>
  Date:   2020-08-14 (Fri, 14 Aug 2020)

  Changed paths:
    M llvm/lib/IR/Globals.cpp
    M llvm/test/CodeGen/AArch64/emutls.ll
    M llvm/test/CodeGen/ARM/emutls.ll
    M llvm/test/CodeGen/X86/2008-03-12-ThreadLocalAlias.ll
    M llvm/test/CodeGen/X86/linux-preemption.ll
    M llvm/test/CodeGen/X86/semantic-interposition-comdat.ll
    M llvm/test/CodeGen/X86/tailcallpic1.ll
    M llvm/test/CodeGen/X86/tailcallpic3.ll
    M llvm/test/CodeGen/X86/tailccpic1.ll

  Log Message:
  -----------
  [X86][ELF] Prefer lowering MC_GlobalAddress operands to .Lfoo$local for STV_DEFAULT only

This patch restricts the behaviour of referencing via .Lfoo$local
local aliases, introduced in https://reviews.llvm.org/D73230, to
STV_DEFAULT globals only.

Hidden symbols via --fvisiblity=hidden (https://gcc.gnu.org/wiki/Visibility)
is an important scenario.

Benefits:

- Improves the size of object files by using fewer STT_SECTION symbols.

- The code reads a bit better (it was not obvious to me without going
  back to the code reviews why the canBenefitFromLocalAlias function
  currently doesn't consider visibility).

- There is also a side benefit in restoring the effectiveness of the
  --wrap linker option and making the behavior of --wrap consistent
  between LTO and normal builds for references within a translation-unit.
  Note: this --wrap behavior (which is specific to LLD) should not be
  considered reliable. See comments on https://reviews.llvm.org/D73230
  for more.

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




More information about the All-commits mailing list