Skip to content

Commit 7d11e12

Browse files
author
git apple-llvm automerger
committed
Merge commit '65850de74d7f' from llvm.org/main into next
2 parents 444ecb2 + 65850de commit 7d11e12

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9465,6 +9465,9 @@ void LinkerWrapper::ConstructJob(Compilation &C, const JobAction &JA,
94659465
};
94669466
auto ShouldForward = [&](const llvm::DenseSet<unsigned> &Set, Arg *A,
94679467
const ToolChain &TC) {
9468+
// CMake hack to avoid printing verbose informatoin for HIP non-RDC mode.
9469+
if (A->getOption().matches(OPT_v) && JA.getType() == types::TY_Object)
9470+
return false;
94689471
return (Set.contains(A->getOption().getID()) ||
94699472
(A->getOption().getGroup().isValid() &&
94709473
Set.contains(A->getOption().getGroup().getID()))) &&
@@ -9540,7 +9543,12 @@ void LinkerWrapper::ConstructJob(Compilation &C, const JobAction &JA,
95409543

95419544
CmdArgs.push_back(
95429545
Args.MakeArgString("--host-triple=" + getToolChain().getTripleString()));
9543-
if (Args.hasArg(options::OPT_v))
9546+
9547+
// CMake hack, suppress passing verbose arguments for the special-case HIP
9548+
// non-RDC mode compilation. This confuses default CMake implicit linker
9549+
// argument parsing when the language is set to HIP and the system linker is
9550+
// also `ld.lld`.
9551+
if (Args.hasArg(options::OPT_v) && JA.getType() != types::TY_Object)
95449552
CmdArgs.push_back("--wrapper-verbose");
95459553
if (Arg *A = Args.getLastArg(options::OPT_cuda_path_EQ))
95469554
CmdArgs.push_back(

clang/test/Driver/hip-toolchain-no-rdc.hip

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,3 +214,10 @@
214214
// AMDGCNSPIRV: {{".*clang-offload-bundler.*"}} "-type=o"
215215
// AMDGCNSPIRV-SAME: "-targets={{.*}}hipv4-spirv64-amd-amdhsa--amdgcnspirv,hipv4-amdgcn-amd-amdhsa--gfx900"
216216
// AMDGCNSPIRV-SAME: "-input=[[AMDGCNSPV_CO]]" "-input=[[GFX900_CO]]"
217+
218+
// Check verbose printing with the new driver.
219+
// RUN: %clang -### --target=x86_64-linux-gnu -fno-gpu-rdc -nogpulib -nogpuinc \
220+
// RUN: --offload-new-driver --offload-arch=gfx908 -v %s 2>&1 | FileCheck %s --check-prefix=VERBOSE
221+
// VERBOSE: clang-linker-wrapper
222+
// VERBOSE-NOT: --device-compiler=amdgcn-amd-amdhsa=-v
223+
// VERBOSE-NOT: --wrapper-verbose

0 commit comments

Comments
 (0)