[PATCH] D141970: [Clang][LLD] Add --lto-CGO[0-3] option

Scott Linder via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 17 14:51:41 PST 2023


scott.linder created this revision.
Herald added subscribers: pmatos, asb, ormris, steven_wu, sunfish, hiraditya, arichardson, inglorion, sbc100, emaste, dschuff.
Herald added a reviewer: MaskRay.
Herald added projects: lld-macho, All.
Herald added a reviewer: lld-macho.
scott.linder requested review of this revision.
Herald added subscribers: llvm-commits, aheejin.
Herald added a project: LLVM.

Allow controlling the CodeGenOpt::Level independent of the LTO
optimization level in LLD via new options for the COFF, ELF, MachO, and
wasm frontends to lld. Most are spelled as --lto-CGO[0-3], but COFF is
spelled as -opt:lldltocgo=[0-3].

Also change the behavior in the default case (i.e. when the CG opt level
is not specified explicitly), mapping each LTO opt level to its
numerically-equivalent CG opt level.

The existing behavior was decided in https://reviews.llvm.org/D57422 and
maps the LTO opt levels to CG opt levels such that it is impossible to
achieve CG opt levels 0 or 1 when using LTO. I think a direct mapping is
less surprising.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D141970

Files:
  lld/COFF/Config.h
  lld/COFF/Driver.cpp
  lld/COFF/LTO.cpp
  lld/Common/Args.cpp
  lld/ELF/Config.h
  lld/ELF/Driver.cpp
  lld/ELF/LTO.cpp
  lld/ELF/Options.td
  lld/MachO/Arch/ARM.cpp
  lld/MachO/Config.h
  lld/MachO/Driver.cpp
  lld/MachO/EhFrame.cpp
  lld/MachO/ICF.cpp
  lld/MachO/InputSection.cpp
  lld/MachO/LTO.cpp
  lld/MachO/Options.td
  lld/MachO/Relocations.cpp
  lld/MachO/UnwindInfoSection.cpp
  lld/include/lld/Common/Args.h
  lld/test/COFF/lto-cgo.ll
  lld/test/ELF/lto/cgo.ll
  lld/test/MachO/lto-cgo.ll
  lld/test/wasm/lto/cgo.ll
  lld/wasm/Config.h
  lld/wasm/Driver.cpp
  lld/wasm/LTO.cpp
  lld/wasm/Options.td

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D141970.489949.patch
Type: text/x-patch
Size: 23623 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230117/c4ddce53/attachment.bin>


More information about the llvm-commits mailing list