[llvm] 96e7487 - [NVPTX] Fix LIT tests with default nameTableKind

Andrew Savonichev via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 21 06:14:17 PDT 2022


Author: Andrew Savonichev
Date: 2022-04-21T16:05:25+03:00
New Revision: 96e7487013776c26f0a5203b2e4b104b61efcedf

URL: https://github.com/llvm/llvm-project/commit/96e7487013776c26f0a5203b2e4b104b61efcedf
DIFF: https://github.com/llvm/llvm-project/commit/96e7487013776c26f0a5203b2e4b104b61efcedf.diff

LOG: [NVPTX] Fix LIT tests with default nameTableKind

Default nameTableKind results in the following DWARF section:

    .section .debug_pubnames
    {
      .b32 LpubNames_end0-LpubNames_start0    // Length of Public Names Info
      LpubNames_start0:
      [...]
      LpubNames_end0:
    }

Without -mattr=+ptx75 ptxas complains about labels and label
expressions:

error   : Feature 'labels1 - labels2 expression in .section' requires
PTX ISA .version 7.5 or later
error   : Feature 'Defining labels in .section' requires PTX ISA
.version 7.0 or later

The patch modifies dbg-value-const-byref.ll to let it run without PTX
7.5 (available from CUDA 11.0), and adds a new test just for this
case.

Differential revision: https://reviews.llvm.org/D124108

Added: 
    llvm/test/DebugInfo/NVPTX/debug-name-table.ll

Modified: 
    llvm/test/DebugInfo/NVPTX/dbg-value-const-byref.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/DebugInfo/NVPTX/dbg-value-const-byref.ll b/llvm/test/DebugInfo/NVPTX/dbg-value-const-byref.ll
index 9fda680aae57c..e3509bb22b637 100644
--- a/llvm/test/DebugInfo/NVPTX/dbg-value-const-byref.ll
+++ b/llvm/test/DebugInfo/NVPTX/dbg-value-const-byref.ll
@@ -54,7 +54,7 @@ attributes #3 = { nounwind }
 !llvm.module.flags = !{!11, !12}
 !llvm.ident = !{!13}
 
-!0 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang version 3.5.0 ", isOptimized: true, emissionKind: FullDebug, file: !1, enums: !2, retainedTypes: !2, globals: !2, imports: !2)
+!0 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang version 3.5.0 ", isOptimized: true, emissionKind: FullDebug, file: !1, enums: !2, retainedTypes: !2, globals: !2, imports: !2, nameTableKind: None)
 !1 = !DIFile(filename: "dbg-value-const-byref.c", directory: "")
 !2 = !{}
 !4 = distinct !DISubprogram(name: "foo", line: 5, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: true, unit: !0, scopeLine: 5, file: !1, scope: !5, type: !6, retainedNodes: !9)

diff  --git a/llvm/test/DebugInfo/NVPTX/debug-name-table.ll b/llvm/test/DebugInfo/NVPTX/debug-name-table.ll
new file mode 100644
index 0000000000000..c19ddaeeb8f73
--- /dev/null
+++ b/llvm/test/DebugInfo/NVPTX/debug-name-table.ll
@@ -0,0 +1,44 @@
+; RUN: llc -mtriple=nvptx64-nvidia-cuda -mattr=+ptx75 < %s | FileCheck %s
+
+; DICompileUnit without 'nameTableKind: None' results in
+; debug_pubnames and debug_pubtypes sections in DWARF. These sections
+; use labels and label expressions, and ptxas requires PTX v7.5 to
+; support them.
+
+; CHECK-LABEL: .section .debug_pubnames
+; CHECK-NEXT: {
+; CHECK-NEXT: .b32 LpubNames_end0-LpubNames_start0
+; CHECK-NEXT: LpubNames_start0:
+; CHECK:      LpubNames_end0:
+; CHECK-NEXT: }
+
+; CHECK-LABEL: .section .debug_pubtypes
+; CHECK-NEXT: {
+; CHECK-NEXT: .b32 LpubTypes_end0-LpubTypes_start0
+; CHECK-NEXT: LpubTypes_start0:
+; CHECK:      LpubTypes_end0:
+; CHECK-NEXT: }
+
+; Function Attrs: nounwind ssp uwtable
+define i32 @foo() #0 !dbg !4 {
+entry:
+  ret i32 0
+}
+
+attributes #0 = { nounwind ssp uwtable }
+
+!llvm.dbg.cu = !{!0}
+!llvm.module.flags = !{!11, !12}
+!llvm.ident = !{!13}
+
+!0 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang version 3.5.0 ", isOptimized: true, emissionKind: FullDebug, file: !1, enums: !2, retainedTypes: !2, globals: !2, imports: !2)
+!1 = !DIFile(filename: "debug-name-table.c", directory: "")
+!2 = !{}
+!4 = distinct !DISubprogram(name: "foo", line: 5, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: true, unit: !0, scopeLine: 5, file: !1, scope: !5, type: !6)
+!5 = !DIFile(filename: "debug-name-table.c", directory: "")
+!6 = !DISubroutineType(types: !7)
+!7 = !{!8}
+!8 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
+!11 = !{i32 2, !"Dwarf Version", i32 2}
+!12 = !{i32 1, !"Debug Info Version", i32 3}
+!13 = !{!"clang version 3.5.0 "}


        


More information about the llvm-commits mailing list