[all-commits] [llvm/llvm-project] 5b22bc: [X86][ELF] Prefer to lower MC_GlobalAddress operan...

Fangrui Song via All-commits all-commits at lists.llvm.org
Thu Jan 30 17:52:59 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 5b22bcc2b70d82c73ce5428170dcc2038a729d74
      https://github.com/llvm/llvm-project/commit/5b22bcc2b70d82c73ce5428170dcc2038a729d74
  Author: Fangrui Song <maskray at google.com>
  Date:   2020-01-30 (Thu, 30 Jan 2020)

  Changed paths:
    M llvm/lib/Target/X86/X86MCInstLower.cpp
    M llvm/test/CodeGen/X86/code-model-elf.ll
    M llvm/test/CodeGen/X86/emutls.ll
    M llvm/test/CodeGen/X86/fold-add-pcrel.ll
    M llvm/test/CodeGen/X86/linux-preemption.ll
    M llvm/test/CodeGen/X86/oddsubvector.ll
    M llvm/test/CodeGen/X86/pr38795.ll
    M llvm/test/CodeGen/X86/tailcallpic1.ll
    M llvm/test/CodeGen/X86/tailcallpic3.ll
    M llvm/test/CodeGen/X86/tailccpic1.ll
    M llvm/test/CodeGen/X86/tls.ll

  Log Message:
  -----------
  [X86][ELF] Prefer to lower MC_GlobalAddress operands to .Lfoo$local

For a MC_GlobalAddress reference to a dso_local external GlobalValue with a definition, emit .Lfoo$local to avoid a relocation.

-fno-pic and -fpie can infer dso_local but -fpic cannot.  In the future,
we can explore the possibility of inferring dso_local with -fpic. As the
description of D73228 says, LLVM's existing IPO optimization behaviors
(like -fno-semantic-interposition) and a previous assembly behavior give
us enough license to be aggressive here.

Reviewed By: rnk

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




More information about the All-commits mailing list