Debian Codegraph @

llvm-project/llvm/projects/llvm-spirv/test/DebugInfo/X86/convert-debugloc.ll

raw
1 ; RUN: llvm-as < %s -o %t.bc
2 ; RUN: llvm-spirv %t.bc -o %t.spv --spirv-allow-extra-diexpressions
3 ; RUN: llvm-spirv -r -emit-opaque-pointers %t.spv -o - | llvm-dis -o %t.ll
4
5 ; RUN: llc -mtriple=%triple -dwarf-version=5 -filetype=obj -O0 < %t.ll | llvm-dwarfdump - \
6 ; RUN: | FileCheck %s --check-prefix=DW5 "--implicit-check-not={{DW_TAG|NULL}}"
7 ; RUN: llc -mtriple=%triple -dwarf-version=4 -filetype=obj -O0 < %t.ll | llvm-dwarfdump - \
8 ; RUN: | FileCheck %s --check-prefix=DW4 "--implicit-check-not={{DW_TAG|NULL}}"
9
10 ; DW5: .debug_info contents:
11 ; DW5: DW_TAG_compile_unit
12 ; DW5:[[SIG8:.*]]: DW_TAG_base_type
13 ; DW5-NEXT:DW_AT_name ("DW_ATE_signed_8")
14 ; DW5-NEXT:DW_AT_encoding (DW_ATE_signed)
15 ; DW5-NEXT:DW_AT_byte_size (0x01)
16 ; DW5-NOT: DW_AT
17 ; DW5:[[SIG32:.*]]: DW_TAG_base_type
18 ; DW5-NEXT:DW_AT_name ("DW_ATE_signed_32")
19 ; DW5-NEXT:DW_AT_encoding (DW_ATE_signed)
20 ; DW5-NEXT:DW_AT_byte_size (0x04)
21 ; DW5-NOT: DW_AT
22 ; DW5: DW_TAG_subprogram
23 ; DW5: DW_TAG_formal_parameter
24 ; DW5: DW_TAG_variable
25 ; DW5: DW_AT_location (
26 ; DW5: {{.*}}, DW_OP_convert ([[SIG8]]) "DW_ATE_signed_8", DW_OP_convert ([[SIG32]]) "DW_ATE_signed_32", DW_OP_stack_value)
27 ; DW5: DW_AT_name ("y")
28 ; DW5: NULL
29 ; DW5: DW_TAG_base_type
30 ; DW5: DW_AT_name ("signed char")
31 ; DW5: DW_TAG_base_type
32 ; DW5: DW_AT_name ("int")
33 ; DW5: NULL
34
35 ; DW4: .debug_info contents:
36 ; DW4: DW_TAG_compile_unit
37 ; DW4: DW_TAG_subprogram
38 ; DW4: DW_TAG_formal_parameter
39 ; DW4: DW_TAG_variable
40 ; DW4: DW_AT_location (
41 ; DW4: {{.*}}, DW_OP_dup, DW_OP_constu 0x7, DW_OP_shr, DW_OP_lit0, DW_OP_not, DW_OP_mul, DW_OP_constu 0x8, DW_OP_shl, DW_OP_or, DW_OP_stack_value)
42 ; DW4: DW_AT_name ("y")
43 ; DW4: NULL
44 ; DW4: DW_TAG_base_type
45 ; DW4: DW_AT_name ("signed char")
46 ; DW4: DW_TAG_base_type
47 ; DW4: DW_AT_name ("int")
48 ; DW4: NULL
49
50 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
51 target triple = "spir64-unknown-unknown"
52
53 ; Function Attrs: noinline nounwind uwtable
54 define dso_local signext i8 @foo(i8 signext %x) !dbg !7 {
55 entry:
56 call void @llvm.dbg.value(metadata i8 %x, metadata !11, metadata !DIExpression()), !dbg !12
57 call void @llvm.dbg.value(metadata i8 32, metadata !13, metadata !DIExpression(DW_OP_lit0, DW_OP_plus, DW_OP_LLVM_convert, 8, DW_ATE_signed, DW_OP_LLVM_convert, 32, DW_ATE_signed, DW_OP_stack_value)), !dbg !15
58 ret i8 %x, !dbg !16
59 }
60
61 ; Function Attrs: nounwind readnone speculatable
62 declare void @llvm.dbg.declare(metadata, metadata, metadata)
63
64 ; Function Attrs: nounwind readnone speculatable
65 declare void @llvm.dbg.value(metadata, metadata, metadata)
66
67 !llvm.dbg.cu = !{!0}
68 !llvm.module.flags = !{!3, !4, !5}
69 !llvm.ident = !{!6}
70
71 !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 9.0.0 (trunk 353791) (llvm/trunk 353801)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, nameTableKind: None)
72 !1 = !DIFile(filename: "dbg.c", directory: "/tmp", checksumkind: CSK_MD5, checksum: "2a034da6937f5b9cf6dd2d89127f57fd")
73 !2 = !{}
74 !3 = !{i32 2, !"Dwarf Version", i32 5}
75 !4 = !{i32 2, !"Debug Info Version", i32 3}
76 !5 = !{i32 1, !"wchar_size", i32 4}
77 !6 = !{!"clang version 9.0.0 (trunk 353791) (llvm/trunk 353801)"}
78 !7 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 1, type: !8, scopeLine: 2, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !2)
79 !8 = !DISubroutineType(types: !9)
80 !9 = !{!10, !10}
81 !10 = !DIBasicType(name: "signed char", size: 8, encoding: DW_ATE_signed_char)
82 !11 = !DILocalVariable(name: "x", arg: 1, scope: !7, file: !1, line: 1, type: !10)
83 !12 = !DILocation(line: 1, column: 29, scope: !7)
84 !13 = !DILocalVariable(name: "y", scope: !7, file: !1, line: 3, type: !14)
85 !14 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
86 !15 = !DILocation(line: 3, column: 14, scope: !7)
87 !16 = !DILocation(line: 4, column: 3, scope: !7)