[Clang][AMDGPU] Set LTO CG opt level based on Clang option
authorScott Linder <Scott.Linder@amd.com>
Wed, 15 Feb 2023 17:29:19 +0000 (17:29 +0000)
committerScott Linder <Scott.Linder@amd.com>
Wed, 15 Feb 2023 17:34:35 +0000 (17:34 +0000)
commit97ba3c2bec48ca55cc842c6499b19b0b8a271951
tree3d3bd8fdd292b1a5d5a641ad4f1777bde921fefb
parent45ee0a9afc6282000e06fa1edb89fe2159a7b34e
[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
clang/lib/Driver/ToolChains/CommonArgs.cpp
clang/lib/Driver/ToolChains/HIPAMD.cpp
clang/test/Driver/hip-toolchain-opt.hip