[all-commits] [llvm/llvm-project] 45ee0a: [LLD] Add --lto-CGO[0-3] option

Scott Linder via All-commits all-commits at lists.llvm.org
Wed Feb 15 09:34:49 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 45ee0a9afc6282000e06fa1edb89fe2159a7b34e
      https://github.com/llvm/llvm-project/commit/45ee0a9afc6282000e06fa1edb89fe2159a7b34e
  Author: Scott Linder <Scott.Linder at amd.com>
  Date:   2023-02-15 (Wed, 15 Feb 2023)

  Changed paths:
    M lld/COFF/Config.h
    M lld/COFF/Driver.cpp
    M lld/COFF/LTO.cpp
    M lld/Common/Args.cpp
    M lld/ELF/Config.h
    M lld/ELF/Driver.cpp
    M lld/ELF/LTO.cpp
    M lld/ELF/Options.td
    M lld/MachO/Config.h
    M lld/MachO/Driver.cpp
    M lld/MachO/LTO.cpp
    M lld/MachO/Options.td
    M lld/include/lld/Common/Args.h
    A lld/test/COFF/lto-cgo.ll
    A lld/test/ELF/lto/cgo.ll
    A lld/test/MachO/lto-cgo.ll
    A lld/test/wasm/lto/cgo.ll
    M lld/wasm/Config.h
    M lld/wasm/Driver.cpp
    M lld/wasm/LTO.cpp
    M lld/wasm/Options.td

  Log Message:
  -----------
  [LLD] Add --lto-CGO[0-3] option

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].

See D57422 for discussion surrounding the issue of how to set the CG opt
level. The ultimate goal is to let each function control its CG opt
level, but until then the current default means it is impossible to
specify a CG opt level lower than 2 while using LTO. This option gives
the user a means to control it for as long as it is not handled on a
per-function basis.

Reviewed By: MaskRay, #lld-macho, int3

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


  Commit: 97ba3c2bec48ca55cc842c6499b19b0b8a271951
      https://github.com/llvm/llvm-project/commit/97ba3c2bec48ca55cc842c6499b19b0b8a271951
  Author: Scott Linder <Scott.Linder at amd.com>
  Date:   2023-02-15 (Wed, 15 Feb 2023)

  Changed paths:
    M clang/lib/Driver/ToolChains/CommonArgs.cpp
    M clang/lib/Driver/ToolChains/HIPAMD.cpp
    M clang/test/Driver/hip-toolchain-opt.hip

  Log Message:
  -----------
  [Clang][AMDGPU] Set LTO CG opt level based on Clang option

For AMDGCN default to mapping --lto-O# to --lto-CGO# in a 1:1 manner
(i.e. clang -O<N> implies --lto-O<N> and --lto-CGO<N>).

Ensure there is a means to override this via -Xoffload-linker and begin
to claim these arguments to avoid incorrect warnings that they are not
used.

Reviewed By: yaxunl, MaskRay

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


Compare: https://github.com/llvm/llvm-project/compare/3cf7f2249825...97ba3c2bec48


More information about the All-commits mailing list