[DEBUGINFO, NVPTX] Disable emission of ',debug' option if only debug directives are allowed.

Summary:
If the output of debug directives only is requested, we should drop
emission of ',debug' option from the target directive. Required for
supporting of nvprof profiler.

Reviewers: echristo

Subscribers: llvm-commits

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

llvm-svn: 348497
This commit is contained in:
Alexey Bataev 2018-12-06 16:25:35 +00:00
parent e4c91f5c4c
commit 2e1a782189
2 changed files with 16 additions and 2 deletions

View File

@ -881,8 +881,22 @@ void NVPTXAsmPrinter::emitHeader(Module &M, raw_ostream &O,
if (NTM.getDrvInterface() == NVPTX::NVCL)
O << ", texmode_independent";
bool HasFullDebugInfo = false;
for (DICompileUnit *CU : M.debug_compile_units()) {
switch(CU->getEmissionKind()) {
case DICompileUnit::NoDebug:
case DICompileUnit::DebugDirectivesOnly:
break;
case DICompileUnit::LineTablesOnly:
case DICompileUnit::FullDebug:
HasFullDebugInfo = true;
break;
}
if (HasFullDebugInfo)
break;
}
// FIXME: remove comment once debug info is properly supported.
if (MMI && MMI->hasDebugInfo())
if (MMI && MMI->hasDebugInfo() && HasFullDebugInfo)
O << "//, debug";
O << "\n";

View File

@ -8,7 +8,7 @@
;__device__ void bar() {}
;}
; CHECK: .target sm_{{[0-9]+}}//, debug
; CHECK: .target sm_{{[0-9]+$}}
; CHECK: .visible .func foo()
; CHECK: .loc [[FOO:[0-9]+]] 1 31