Skip to content

Conversation

@superbobry
Copy link
Contributor

@superbobry superbobry commented May 15, 2025

According to *, only the deprecated @@DWARF directives require setting .target debug.

@llvmbot
Copy link
Member

llvmbot commented May 15, 2025

@llvm/pr-subscribers-debuginfo

@llvm/pr-subscribers-backend-nvptx

Author: Sergei Lebedev (superbobry)

Changes

According to *, only the deprecated @@<!-- -->DWARF directives require setting .target debug.


Full diff: https://github.com/llvm/llvm-project/pull/140146.diff

2 Files Affected:

  • (modified) llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp (+1-1)
  • (modified) llvm/test/DebugInfo/NVPTX/debug-file-loc.ll (+1-1)
diff --git a/llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp b/llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp
index 0e5207cf9b04c..5b5d72e310ce2 100644
--- a/llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp
+++ b/llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp
@@ -745,8 +745,8 @@ void NVPTXAsmPrinter::emitHeader(Module &M, raw_ostream &O,
     switch(CU->getEmissionKind()) {
     case DICompileUnit::NoDebug:
     case DICompileUnit::DebugDirectivesOnly:
-      break;
     case DICompileUnit::LineTablesOnly:
+      break;
     case DICompileUnit::FullDebug:
       HasFullDebugInfo = true;
       break;
diff --git a/llvm/test/DebugInfo/NVPTX/debug-file-loc.ll b/llvm/test/DebugInfo/NVPTX/debug-file-loc.ll
index 9d1d3506a3f19..258f8e79ad63a 100644
--- a/llvm/test/DebugInfo/NVPTX/debug-file-loc.ll
+++ b/llvm/test/DebugInfo/NVPTX/debug-file-loc.ll
@@ -9,7 +9,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

@superbobry
Copy link
Contributor Author

PTX ISA is somewhat ambiguous in that section, but empirically ptxas does accept PTX with .section directives without .target debug.

@Artem-B Artem-B requested review from Artem-B and dwblaikie May 16, 2025 17:26
case DICompileUnit::DebugDirectivesOnly:
break;
case DICompileUnit::LineTablesOnly:
break;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dwblaikie Do I understand it correctly that LineTablesOnly only implies that debug info will be limited to line info only, but it does not say anything about the format of that info. I.e. that it could be either done via debug directives or via DWARF.

If that's the case, then this change is wrong, and the current code is correct.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LineTablesOnly unfortunately means /almost/ line tables only - it actually means line tables, /and/ enough of .debug_info to describe inlining.

The DebugDirectivesOnly is means /really/ only the debug directives that generate only the line table (.debug_line (and in DWARFv5, .debug_line_str)).

@superbobry superbobry closed this May 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants