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 = 0x62f17241069b1fa3
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_subprogram
45 ; CONV: DW_TAG_formal_parameter
46 ; CONV: DW_TAG_variable
47 ; CONV: DW_AT_location {{.*}}DW_OP_constu 0x20, DW_OP_lit0, DW_OP_plus, DW_OP_convert (
48 ; VERBOSE-SAME: [[SIG8]] ->
49 ; CONV-SAME: [[SIG8]]) "DW_ATE_signed_8", DW_OP_convert (
50 ; VERBOSE-SAME: [[SIG32]] ->
51 ; CONV-SAME: [[SIG32]]) "DW_ATE_signed_32", DW_OP_stack_value)
52 ; CONV: DW_AT_name {{.*}}"y")
54 ; CONV: DW_TAG_base_type
55 ; CONV: DW_AT_name {{.*}}"signed char")
56 ; CONV: DW_TAG_base_type
57 ; CONV: DW_AT_name {{.*}}"int")
60 ; NOCONV: DW_TAG_compile_unit
61 ; NOCONV: DW_TAG_subprogram
62 ; NOCONV: DW_TAG_formal_parameter
63 ; NOCONV: DW_TAG_variable
64 ; NOCONV: DW_AT_location (
65 ; 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)
66 ; NOCONV: DW_AT_name ("y")
68 ; NOCONV: DW_TAG_base_type
69 ; NOCONV: DW_AT_name ("signed char")
70 ; NOCONV: DW_TAG_base_type
71 ; NOCONV: DW_AT_name ("int")
75 ; Function Attrs: noinline nounwind uwtable
76 define dso_local signext i8 @foo(i8 signext %x) !dbg !7 {
78 call void @llvm.dbg.value(metadata i8 %x, metadata !11, metadata !DIExpression()), !dbg !12
79 ;; This test depends on "convert" surviving all the way to the final object.
80 ;; So, insert something before DW_OP_LLVM_convert that the expression folder
81 ;; will not attempt to eliminate. At the moment, only "convert" ops are folded.
82 ;; If you have to change the expression, the expected DWO_id also changes.
83 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
87 ; Function Attrs: nounwind readnone speculatable
88 declare void @llvm.dbg.declare(metadata, metadata, metadata)
90 ; Function Attrs: nounwind readnone speculatable
91 declare void @llvm.dbg.value(metadata, metadata, metadata)
94 !llvm.module.flags = !{!3, !4, !5}
97 !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)
98 !1 = !DIFile(filename: "dbg.c", directory: "/tmp", checksumkind: CSK_MD5, checksum: "2a034da6937f5b9cf6dd2d89127f57fd")
100 !3 = !{i32 2, !"Dwarf Version", i32 5}
101 !4 = !{i32 2, !"Debug Info Version", i32 3}
102 !5 = !{i32 1, !"wchar_size", i32 4}
103 !6 = !{!"clang version 9.0.0 (trunk 353791) (llvm/trunk 353801)"}
104 !7 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 1, type: !8, scopeLine: 2, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !2)
105 !8 = !DISubroutineType(types: !9)
107 !10 = !DIBasicType(name: "signed char", size: 8, encoding: DW_ATE_signed_char)
108 !11 = !DILocalVariable(name: "x", arg: 1, scope: !7, file: !1, line: 1, type: !10)
109 !12 = !DILocation(line: 1, column: 29, scope: !7)
110 !13 = !DILocalVariable(name: "y", scope: !7, file: !1, line: 3, type: !14)
111 !14 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
112 !15 = !DILocation(line: 3, column: 14, scope: !7)
113 !16 = !DILocation(line: 4, column: 3, scope: !7)