1 ; RUN: llc -mtriple=x86_64 -dwarf-version=4 -filetype=obj -O0 < %s | llvm-dwarfdump - \
2 ; RUN: | FileCheck %s --check-prefix=NOCONV "--implicit-check-not={{DW_TAG|NULL}}"
4 ; Test lldb default: OP_convert is unsupported when using MachO
5 ; RUN: llc -mtriple=x86_64-apple-darwin -dwarf-version=5 -filetype=obj -O0 < %s -debugger-tune=lldb | llvm-dwarfdump - \
6 ; RUN: | FileCheck %s --check-prefix=CONV "--implicit-check-not={{DW_TAG|NULL}}"
7 ; RUN: llc -mtriple=x86_64-pc-linux-gnu -dwarf-version=5 -filetype=obj -O0 < %s -debugger-tune=lldb | llvm-dwarfdump - \
8 ; RUN: | FileCheck %s --check-prefix=NOCONV "--implicit-check-not={{DW_TAG|NULL}}"
10 ; Test gdb default: OP_convert is only disabled in split DWARF
11 ; RUN: llc -mtriple=x86_64 -dwarf-version=5 -filetype=obj -O0 < %s -debugger-tune=gdb | llvm-dwarfdump - \
12 ; RUN: | FileCheck %s --check-prefix=CONV "--implicit-check-not={{DW_TAG|NULL}}"
13 ; RUN: llc -mtriple=x86_64-pc-linux-gnu -dwarf-version=5 -filetype=obj -O0 < %s -debugger-tune=gdb -split-dwarf-file=baz.dwo | llvm-dwarfdump - \
14 ; RUN: | FileCheck %s --check-prefix=NOCONV --check-prefix=SPLIT "--implicit-check-not={{DW_TAG|NULL}}"
16 ; Test the ability to override the platform default in either direction
17 ; RUN: llc -mtriple=x86_64 -dwarf-version=5 -filetype=obj -O0 < %s -debugger-tune=gdb -dwarf-op-convert=Disable | llvm-dwarfdump - \
18 ; RUN: | FileCheck %s --check-prefix=NOCONV "--implicit-check-not={{DW_TAG|NULL}}"
19 ; RUN: llc -mtriple=x86_64-pc-linux-gnu -dwarf-version=5 -filetype=obj -O0 < %s -debugger-tune=lldb -dwarf-op-convert=Enable | llvm-dwarfdump - \
20 ; RUN: | FileCheck %s --check-prefix=CONV "--implicit-check-not={{DW_TAG|NULL}}"
22 ; Test DW_OP_convert + Split DWARF
23 ; RUN: llc -mtriple=x86_64-pc-linux-gnu -dwarf-version=5 -filetype=obj -O0 < %s -debugger-tune=lldb -dwarf-op-convert=Enable -split-dwarf-file=baz.dwo | llvm-dwarfdump - \
24 ; RUN: | FileCheck %s --check-prefix=CONV --check-prefix=SPLITCONV --check-prefix=SPLIT "--implicit-check-not={{DW_TAG|NULL}}"
26 ; RUN: llc -mtriple=x86_64 -dwarf-version=5 -filetype=obj -O0 < %s -debugger-tune=gdb | llvm-dwarfdump -v -debug-info - \
27 ; RUN: | FileCheck %s --check-prefix=VERBOSE --check-prefix=CONV "--implicit-check-not={{DW_TAG|NULL}}"
30 ; SPLITCONV: Compile Unit:{{.*}} DWO_id = 0x24191746f389535f
31 ; SPLIT: DW_TAG_skeleton_unit
33 ; CONV: DW_TAG_compile_unit
34 ; CONV:[[SIG8:.*]]: DW_TAG_base_type
35 ; CONV-NEXT:DW_AT_name {{.*}}"DW_ATE_signed_8")
36 ; CONV-NEXT:DW_AT_encoding {{.*}}DW_ATE_signed)
37 ; CONV-NEXT:DW_AT_byte_size {{.*}}0x01)
39 ; CONV:[[SIG32:.*]]: DW_TAG_base_type
40 ; CONV-NEXT:DW_AT_name {{.*}}"DW_ATE_signed_32")
41 ; CONV-NEXT:DW_AT_encoding {{.*}}DW_ATE_signed)
42 ; CONV-NEXT:DW_AT_byte_size {{.*}}0x04)
44 ; CONV: DW_TAG_base_type
45 ; CONV: DW_TAG_base_type
46 ; CONV: DW_TAG_subprogram
47 ; CONV: DW_TAG_formal_parameter
48 ; CONV: DW_TAG_variable
49 ; CONV: DW_AT_location {{.*}}DW_OP_constu 0x20, DW_OP_lit0, DW_OP_plus, DW_OP_convert (
50 ; VERBOSE-SAME: [[SIG8]] ->
51 ; CONV-SAME: [[SIG8]]) "DW_ATE_signed_8", DW_OP_convert (
52 ; VERBOSE-SAME: [[SIG32]] ->
53 ; CONV-SAME: [[SIG32]]) "DW_ATE_signed_32", DW_OP_stack_value)
54 ; CONV: DW_AT_name {{.*}}"y")
55 ; CONV: DW_TAG_variable
57 ; CONV: DW_TAG_base_type
58 ; CONV: DW_AT_name {{.*}}"signed char")
59 ; CONV: DW_TAG_base_type
60 ; CONV: DW_AT_name {{.*}}"int")
61 ; CONV: DW_TAG_base_type
62 ; CONV: DW_AT_name {{.*}}"unsigned long long")
65 ; NOCONV: DW_TAG_compile_unit
66 ; NOCONV: DW_TAG_subprogram
67 ; NOCONV: DW_TAG_formal_parameter
68 ; NOCONV: DW_TAG_variable
69 ; NOCONV: DW_AT_location (
70 ; NOCONV: {{.*}}, 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)
71 ; NOCONV: DW_AT_name ("y")
72 ; NOCONV: DW_TAG_variable
73 ; NOCONV: DW_AT_location (
74 ; NOCONV: DW_OP_constu 0x40, DW_OP_lit0, DW_OP_plus, DW_OP_lit1, DW_OP_constu 0x40, DW_OP_shl, DW_OP_lit1, DW_OP_minus, DW_OP_and, DW_OP_stack_value)
75 ; NOCONV: DW_AT_name ("z")
77 ; NOCONV: DW_TAG_base_type
78 ; NOCONV: DW_AT_name ("signed char")
79 ; NOCONV: DW_TAG_base_type
80 ; NOCONV: DW_AT_name ("int")
81 ; NOCONV: DW_TAG_base_type
82 ; NOCONV: DW_AT_name ("unsigned long long")
86 ; Function Attrs: noinline nounwind uwtable
87 define dso_local signext i8 @foo(i8 signext %x) !dbg !7 {
89 call void @llvm.dbg.value(metadata i8 %x, metadata !11, metadata !DIExpression()), !dbg !12
90 ;; This test depends on "convert" surviving all the way to the final object.
91 ;; So, insert something before DW_OP_LLVM_convert that the expression folder
92 ;; will not attempt to eliminate. At the moment, only "convert" ops are folded.
93 ;; If you have to change the expression, the expected DWO_id also changes.
94 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
95 call void @llvm.dbg.value(metadata i8 64, metadata !17, metadata !DIExpression(DW_OP_lit0, DW_OP_plus, DW_OP_LLVM_convert, 64, DW_ATE_unsigned, DW_OP_LLVM_convert, 128, DW_ATE_unsigned, DW_OP_LLVM_convert, 64, DW_ATE_unsigned, DW_OP_stack_value)), !dbg !15
99 ; Function Attrs: nounwind readnone speculatable
100 declare void @llvm.dbg.declare(metadata, metadata, metadata)
102 ; Function Attrs: nounwind readnone speculatable
103 declare void @llvm.dbg.value(metadata, metadata, metadata)
106 !llvm.module.flags = !{!3, !4, !5}
109 !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)
110 !1 = !DIFile(filename: "dbg.c", directory: "/tmp", checksumkind: CSK_MD5, checksum: "2a034da6937f5b9cf6dd2d89127f57fd")
112 !3 = !{i32 2, !"Dwarf Version", i32 5}
113 !4 = !{i32 2, !"Debug Info Version", i32 3}
114 !5 = !{i32 1, !"wchar_size", i32 4}
115 !6 = !{!"clang version 9.0.0 (trunk 353791) (llvm/trunk 353801)"}
116 !7 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 1, type: !8, scopeLine: 2, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !2)
117 !8 = !DISubroutineType(types: !9)
119 !10 = !DIBasicType(name: "signed char", size: 8, encoding: DW_ATE_signed_char)
120 !11 = !DILocalVariable(name: "x", arg: 1, scope: !7, file: !1, line: 1, type: !10)
121 !12 = !DILocation(line: 1, column: 29, scope: !7)
122 !13 = !DILocalVariable(name: "y", scope: !7, file: !1, line: 3, type: !14)
123 !14 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
124 !15 = !DILocation(line: 3, column: 14, scope: !7)
125 !16 = !DILocation(line: 4, column: 3, scope: !7)
126 !17 = !DILocalVariable(name: "z", scope: !7, file: !1, line: 3, type: !18)
127 !18 = !DIBasicType(name: "unsigned long long", size: 64, encoding: DW_ATE_unsigned)