[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
This commit is contained in:
Joseph Huber 2021-01-06 10:20:34 -05:00 committed by Huber, Joseph
parent 90347ab96f
commit 1ca5e68aa0
2 changed files with 4 additions and 4 deletions

View File

@ -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);

View File

@ -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,