Debian Codegraph @

llvm-project/llvm/projects/llvm-spirv/test/DebugInfo/X86/dwarf-linkage-names.ll

raw
1 ; DWARF linkage name attributes are optional; verify they are missing for
2 ; PS4 triple or when tuning for SCE.
3
4 ; RUN: llvm-as < %s -o %t.bc
5 ; RUN: llvm-spirv %t.bc -o %t.spv
6 ; RUN: llvm-spirv -r -emit-opaque-pointers %t.spv -o - | llvm-dis -o %t.ll
7
8 ; RUN: llc -O0 -mtriple=x86_64-unknown-unknown < %t.ll | FileCheck %s -check-prefix LINKAGE1
9 ; RUN: llc -O0 -mtriple=x86_64-unknown-unknown < %t.ll | FileCheck %s -check-prefix LINKAGE2
10 ; RUN: llc -O0 -mtriple=x86_64-scei-ps4 < %t.ll | FileCheck %s -check-prefix NOLINKAGE
11 ; RUN: llc -O0 -mtriple=x86_64-unknown-unknown -debugger-tune=sce < %t.ll | FileCheck %s -check-prefix NOLINKAGE
12
13 target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-n8:16:32:64"
14 target triple = "spir64-unknown-unknown"
15
16 ; $ clang++ -emit-llvm -S -g dwarf-linkage-names.cpp
17 ; namespace test {
18 ; int global_var;
19 ; int bar() { return global_var; }
20 ;};
21
22 ; With linkage names, we get an attribute for the declaration (first) entry
23 ; for the global variable, and one for the function.
24
25 ; This assumes the variable will appear before the function.
26 ; LINKAGE1: .section .debug_info
27 ; LINKAGE1: DW_TAG_variable
28 ; LINKAGE1-NOT: DW_TAG
29 ; LINKAGE1: {{DW_AT_(MIPS_)?linkage_name}}
30 ; LINKAGE1: DW_TAG_subprogram
31 ; LINKAGE1-NOT: DW_TAG
32 ; LINKAGE1: {{DW_AT_(MIPS_)?linkage_name}}
33 ; LINKAGE1: .section
34
35 ; Also verify we see the mangled names. We do this as a separate pass to
36 ; avoid depending on the order of .debug_info and .debug_str sections.
37
38 ; LINKAGE2-DAG: .asciz "_ZN4test10global_varE"
39 ; LINKAGE2-DAG: .asciz "_ZN4test3barEv"
40
41 ; Without linkage names, verify there aren't any linkage-name attributes,
42 ; and no mangled names.
43
44 ; NOLINKAGE-NOT: {{DW_AT_(MIPS_)?linkage_name}}
45 ; NOLINKAGE-NOT: .asciz "_ZN4test10global_varE"
46 ; NOLINKAGE-NOT: .asciz "_ZN4test3barEv"
47
48 source_filename = "test/DebugInfo/X86/dwarf-linkage-names.ll"
49
50 @_ZN4test10global_varE = global i32 0, align 4, !dbg !0
51
52 ; Function Attrs: nounwind uwtable
53 define i32 @_ZN4test3barEv() #0 !dbg !11 {
54 entry:
55 %0 = load i32, i32* @_ZN4test10global_varE, align 4, !dbg !14
56 ret i32 %0, !dbg !15
57 }
58
59 attributes #0 = { nounwind uwtable "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+sse,+sse2" "unsafe-fp-math"="false" "use-soft-float"="false" }
60
61 !llvm.dbg.cu = !{!5}
62 !llvm.module.flags = !{!8, !9}
63 !llvm.ident = !{!10}
64
65 !0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
66 !1 = !DIGlobalVariable(name: "global_var", linkageName: "_ZN4test10global_varE", scope: !2, file: !3, line: 2, type: !4, isLocal: false, isDefinition: true)
67 !2 = !DINamespace(name: "test", scope: null)
68 !3 = !DIFile(filename: "dwarf-linkage-names.cpp", directory: "/home/probinson/projects/scratch")
69 !4 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
70 !5 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !3, producer: "clang version 3.8.0 (trunk 244662)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !6, globals: !7)
71 !6 = !{}
72 !7 = !{!0}
73 !8 = !{i32 2, !"Dwarf Version", i32 4}
74 !9 = !{i32 2, !"Debug Info Version", i32 3}
75 !10 = !{!"clang version 3.8.0 (trunk 244662)"}
76 !11 = distinct !DISubprogram(name: "bar", linkageName: "_ZN4test3barEv", scope: !2, file: !3, line: 3, type: !12, isLocal: false, isDefinition: true, scopeLine: 3, flags: DIFlagPrototyped, isOptimized: false, unit: !5, retainedNodes: !6)
77 !12 = !DISubroutineType(types: !13)
78 !13 = !{!4}
79 !14 = !DILocation(line: 3, column: 21, scope: !11)
80 !15 = !DILocation(line: 3, column: 14, scope: !11)
81