From 1ca5e68aa07e30567c6aa2409c5641e0a2d77355 Mon Sep 17 00:00:00 2001 From: Joseph Huber Date: Wed, 6 Jan 2021 10:20:34 -0500 Subject: [PATCH] [NVPTX] Fix debugging information being added to NVPTX target if remarks are enabled Summary: Optimized debugging is not supported by ptxas. Debugging information is degraded to line information only if optimizations are enabled, but debugging information would be added back in by the driver if remarks were enabled. This solves https://bugs.llvm.org/show_bug.cgi?id=48153. Reviewers: jdoerfert tra jholewinski serge-sans-paille Differential Revision: https://reviews.llvm.org/D94123 --- clang/lib/Driver/ToolChains/Clang.cpp | 6 +++--- clang/lib/Driver/ToolChains/Cuda.cpp | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index 917601836c0..a462758bf1c 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -3940,14 +3940,14 @@ static void RenderDebugOptions(const ToolChain &TC, const Driver &D, CmdArgs.push_back("-gno-inline-line-tables"); } - // Adjust the debug info kind for the given toolchain. - TC.adjustDebugInfoKind(DebugInfoKind, Args); - // When emitting remarks, we need at least debug lines in the output. if (willEmitRemarks(Args) && DebugInfoKind <= codegenoptions::DebugDirectivesOnly) DebugInfoKind = codegenoptions::DebugLineTablesOnly; + // Adjust the debug info kind for the given toolchain. + TC.adjustDebugInfoKind(DebugInfoKind, Args); + RenderDebugEnablingArgs(Args, CmdArgs, DebugInfoKind, EffectiveDWARFVersion, DebuggerTuning); diff --git a/clang/lib/Driver/ToolChains/Cuda.cpp b/clang/lib/Driver/ToolChains/Cuda.cpp index 58178d5d11b..95fd5a1fbfe 100644 --- a/clang/lib/Driver/ToolChains/Cuda.cpp +++ b/clang/lib/Driver/ToolChains/Cuda.cpp @@ -384,7 +384,7 @@ static DeviceDebugInfoLevel mustEmitDebugInfo(const ArgList &Args) { } return IsDebugEnabled ? EmitSameDebugInfoAsHost : DebugDirectivesOnly; } - return DisableDebugInfo; + return willEmitRemarks(Args) ? DebugDirectivesOnly : DisableDebugInfo; } void NVPTX::Assembler::ConstructJob(Compilation &C, const JobAction &JA, -- 2.11.0