1; RUN: llc < %s -mtriple=nvptx64-nvidia-cuda | FileCheck %s
2
3; // Bitcode int this test case is reduced version of compiled code below:
4;extern "C" {
5;#line 1 "/source/dir/foo.h"
6;__device__ void foo() {}
7;#line 2 "/source/dir/bar.cu"
8;__device__ void bar() {}
9;}
10
11; CHECK: .target sm_{{[0-9]+}}, debug
12
13; CHECK: .visible .func foo()
14; CHECK: .loc [[FOO:[0-9]+]] 1 31
15; CHECK:  ret;
16; CHECK: .visible .func bar()
17; CHECK: .loc [[BAR:[0-9]+]] 2 31
18; CHECK:  ret;
19
20define void @foo() !dbg !4 {
21bb:
22  ret void, !dbg !10
23}
24
25define void @bar() !dbg !7 {
26bb:
27  ret void, !dbg !11
28}
29
30; CHECK-DAG: .file [[FOO]] "{{.*}}foo.h"
31; CHECK-DAG: .file [[BAR]] "{{.*}}bar.cu"
32; CHECK: .section .debug_abbrev
33; CHECK-NEXT: {
34; CHECK-NEXT: .b8 1                                // Abbreviation Code
35; CHECK-NEXT: .b8 17                               // DW_TAG_compile_unit
36; CHECK-NEXT: .b8 0                                // DW_CHILDREN_no
37; CHECK-NEXT: .b8 37                               // DW_AT_producer
38; CHECK-NEXT: .b8 8                                // DW_FORM_string
39; CHECK-NEXT: .b8 19                               // DW_AT_language
40; CHECK-NEXT: .b8 5                                // DW_FORM_data2
41; CHECK-NEXT: .b8 3                                // DW_AT_name
42; CHECK-NEXT: .b8 8                                // DW_FORM_string
43; CHECK-NEXT: .b8 16                               // DW_AT_stmt_list
44; CHECK-NEXT: .b8 6                                // DW_FORM_data4
45; CHECK-NEXT: .b8 27                               // DW_AT_comp_dir
46; CHECK-NEXT: .b8 8                                // DW_FORM_string
47; CHECK-NEXT: .b8 17                               // DW_AT_low_pc
48; CHECK-NEXT: .b8 1                                // DW_FORM_addr
49; CHECK-NEXT: .b8 18                               // DW_AT_high_pc
50; CHECK-NEXT: .b8 1                                // DW_FORM_addr
51; CHECK-NEXT: .b8 0                                // EOM(1)
52; CHECK-NEXT: .b8 0                                // EOM(2)
53; CHECK-NEXT: .b8 0                                // EOM(3)
54; CHECK-NEXT: }
55; CHECK-NEXT: .section .debug_info
56; CHECK-NEXT: {
57; CHECK-NEXT: .b32 50                              // Length of Unit
58; CHECK-NEXT: .b8 2                                // DWARF version number
59; CHECK-NEXT: .b8 0
60; CHECK-NEXT: .b32 .debug_abbrev                   // Offset Into Abbrev. Section
61; CHECK-NEXT: .b8 8                                // Address Size (in bytes)
62; CHECK-NEXT: .b8 1                                // Abbrev [1] 0xb:0x2b DW_TAG_compile_unit
63; CHECK-NEXT: .b8 0                                // DW_AT_producer
64; CHECK-NEXT: .b8 4                                // DW_AT_language
65; CHECK-NEXT: .b8 0
66; CHECK-NEXT: .b8 98                               // DW_AT_name
67; CHECK-NEXT: .b8 97
68; CHECK-NEXT: .b8 114
69; CHECK-NEXT: .b8 46
70; CHECK-NEXT: .b8 99
71; CHECK-NEXT: .b8 117
72; CHECK-NEXT: .b8 0
73; CHECK-NEXT: .b32 .debug_line                     // DW_AT_stmt_list
74; CHECK-NEXT: .b8 47                               // DW_AT_comp_dir
75; CHECK-NEXT: .b8 115
76; CHECK-NEXT: .b8 111
77; CHECK-NEXT: .b8 117
78; CHECK-NEXT: .b8 114
79; CHECK-NEXT: .b8 99
80; CHECK-NEXT: .b8 101
81; CHECK-NEXT: .b8 47
82; CHECK-NEXT: .b8 100
83; CHECK-NEXT: .b8 105
84; CHECK-NEXT: .b8 114
85; CHECK-NEXT: .b8 0
86; CHECK-NEXT: .b64 Lfunc_begin0                    // DW_AT_low_pc
87; CHECK-NEXT: .b64 Lfunc_end1                      // DW_AT_high_pc
88; CHECK-NEXT: }
89; CHECK-NEXT: .section .debug_loc { }
90; CHECK-NOT: debug_
91
92!llvm.dbg.cu = !{!0}
93!llvm.module.flags = !{!8, !9}
94
95!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "", isOptimized: false, runtimeVersion: 0, emissionKind: LineTablesOnly, enums: !2)
96!1 = !DIFile(filename: "bar.cu", directory: "/source/dir")
97!2 = !{}
98!4 = distinct !DISubprogram(name: "foo", scope: !5, file: !5, line: 1, type: !6, isLocal: false, isDefinition: true, scopeLine: 1, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)
99!5 = !DIFile(filename: "foo.h", directory: "/source/dir")
100!6 = !DISubroutineType(types: !2)
101!7 = distinct !DISubprogram(name: "bar", scope: !1, file: !1, line: 2, type: !6, isLocal: false, isDefinition: true, scopeLine: 2, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)
102!8 = !{i32 2, !"Dwarf Version", i32 2}
103!9 = !{i32 2, !"Debug Info Version", i32 3}
104!10 = !DILocation(line: 1, column: 31, scope: !4)
105!11 = !DILocation(line: 2, column: 31, scope: !7)
106