Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / llvm / test / MC / WebAssembly / dwarfdump.ll
blobb6a625b15fcd2aef596da6ab33c5fa23c714b6c4
1 ; RUN: llc -filetype=obj %s -o - | llvm-dwarfdump - | FileCheck %s
2 ; RUN: llc -filetype=obj --split-dwarf-file=%t.dwo --split-dwarf-output=%t.dwo %s -o %t.o
3 ; RUN: llvm-dwarfdump %t.dwo | FileCheck %s -check-prefix=SPLIT
5 ; CHECK: .debug_info contents:
6 ; CHECK-NEXT: 0x00000000: Compile Unit: length = 0x0000006e, format = DWARF32, version = 0x0004, abbr_offset = 0x0000, addr_size = 0x04 (next unit at 0x00000072)
8 ; CHECK: 0x0000000b: DW_TAG_compile_unit
9 ; CHECK-NEXT:              DW_AT_producer       ("clang version 6.0.0 (trunk 315924) (llvm/trunk 315960)")
10 ; CHECK-NEXT:              DW_AT_language       (DW_LANG_C99)
11 ; CHECK-NEXT:              DW_AT_name   ("test.c")
12 ; CHECK-NEXT:              DW_AT_stmt_list      (0x00000000)
13 ; CHECK-NEXT:              DW_AT_comp_dir       ("/usr/local/google/home/sbc/dev/wasm/simple")
14 ; CHECK-NEXT:              DW_AT_GNU_pubnames   (true)
15 ; CHECK-NEXT:              DW_AT_low_pc         (0x00000002)
16 ; CHECK-NEXT:              DW_AT_high_pc        (0x00000004)
18 ; CHECK: 0x00000026:   DW_TAG_variable
19 ; CHECK-NEXT:                DW_AT_name ("foo")
20 ; CHECK-NEXT:                DW_AT_type (0x00000037 "int *")
21 ; CHECK-NEXT:                DW_AT_external     (true)
22 ; CHECK-NEXT:                DW_AT_decl_file    ("/usr/local/google/home/sbc/dev/wasm/simple{{[/\\]}}test.c")
23 ; CHECK-NEXT:                DW_AT_decl_line    (4)
24 ; CHECK-NEXT:                DW_AT_location     (DW_OP_addr 0x0)
26 ; CHECK: 0x00000037:   DW_TAG_pointer_type
27 ; CHECK-NEXT:                DW_AT_type (0x0000003c "int")
29 ; CHECK: 0x0000003c:   DW_TAG_base_type
30 ; CHECK-NEXT:                DW_AT_name ("int")
31 ; CHECK-NEXT:                DW_AT_encoding     (DW_ATE_signed)
32 ; CHECK-NEXT:                DW_AT_byte_size    (0x04)
34 ; CHECK: 0x00000043:   DW_TAG_variable
35 ; CHECK-NEXT:                DW_AT_name ("ptr2")
36 ; CHECK-NEXT:                DW_AT_type (0x00000054 "void (*)()")
37 ; CHECK-NEXT:                DW_AT_external     (true)
38 ; CHECK-NEXT:                DW_AT_decl_file    ("/usr/local/google/home/sbc/dev/wasm/simple{{[/\\]}}test.c")
39 ; CHECK-NEXT:                DW_AT_decl_line    (5)
40 ; CHECK-NEXT:                DW_AT_location     (DW_OP_addr 0x4)
42 ; CHECK: 0x00000054:   DW_TAG_pointer_type
43 ; CHECK-NEXT:                DW_AT_type (0x00000059 "void ()")
45 ; CHECK: 0x00000059:   DW_TAG_subroutine_type
46 ; CHECK-NEXT:                DW_AT_prototyped   (true)
48 ; CHECK: 0x0000005a:   DW_TAG_subprogram
49 ; CHECK-NEXT:                DW_AT_low_pc       (0x00000002)
50 ; CHECK-NEXT:                DW_AT_high_pc      (0x00000004)
51 ; CHECK-NEXT:                DW_AT_frame_base   (DW_OP_WASM_location 0x3 0x0, DW_OP_stack_value)
52 ; CHECK-NEXT:                DW_AT_name ("f2")
53 ; CHECK-NEXT:                DW_AT_decl_file    ("/usr/local/google/home/sbc/dev/wasm/simple{{[/\\]}}test.c")
54 ; CHECK-NEXT:                DW_AT_decl_line    (2)
55 ; CHECK-NEXT:                DW_AT_prototyped   (true)
56 ; CHECK-NEXT:                DW_AT_external             (true)
58 ; CHECK: 0x00000071:   NULL
61 ; SPLIT:      .debug_info.dwo contents:
62 ; SPLIT-NEXT: 0x00000000: Compile Unit: length = 0x0000004c, format = DWARF32, version = 0x0004, abbr_offset = 0x0000, addr_size = 0x04 (next unit at 0x00000050)
64 ; SPLIT:      0x0000000b: DW_TAG_compile_unit
65 ; SPLIT-NEXT:               DW_AT_producer    ("clang version 6.0.0 (trunk 315924) (llvm/trunk 315960)")
66 ; SPLIT-NEXT:               DW_AT_language    (DW_LANG_C99)
67 ; SPLIT-NEXT:               DW_AT_name        ("test.c")
68 ; SPLIT-NEXT:               DW_AT_GNU_dwo_name        ("{{.*}}dwarfdump.ll.tmp.dwo")
69 ; SPLIT-NEXT:               DW_AT_GNU_dwo_id  (0xad3151f12153fa17)
71 ; SPLIT:      0x00000019:   DW_TAG_variable
72 ; SPLIT-NEXT:                 DW_AT_name      ("foo")
73 ; SPLIT-NEXT:                 DW_AT_type      (0x00000024 "int *")
74 ; SPLIT-NEXT:                 DW_AT_external  (true)
75 ; SPLIT-NEXT:                 DW_AT_decl_file (0x01)
76 ; SPLIT-NEXT:                 DW_AT_decl_line (4)
77 ; SPLIT-NEXT:                 DW_AT_location  (DW_OP_GNU_addr_index 0x0)
79 ; SPLIT:      0x00000024:   DW_TAG_pointer_type
80 ; SPLIT-NEXT:                 DW_AT_type      (0x00000029 "int")
82 ; SPLIT:      0x00000029:   DW_TAG_base_type
83 ; SPLIT-NEXT:                 DW_AT_name      ("int")
84 ; SPLIT-NEXT:                 DW_AT_encoding  (DW_ATE_signed)
85 ; SPLIT-NEXT:                 DW_AT_byte_size (0x04)
87 ; SPLIT:      0x0000002d:   DW_TAG_variable
88 ; SPLIT-NEXT:                 DW_AT_name      ("ptr2")
89 ; SPLIT-NEXT:                 DW_AT_type      (0x00000038 "void (*)()")
90 ; SPLIT-NEXT:                 DW_AT_external  (true)
91 ; SPLIT-NEXT:                 DW_AT_decl_file (0x01)
92 ; SPLIT-NEXT:                 DW_AT_decl_line (5)
93 ; SPLIT-NEXT:                 DW_AT_location  (DW_OP_GNU_addr_index 0x1)
95 ; SPLIT:      0x00000038:   DW_TAG_pointer_type
96 ; SPLIT-NEXT:                 DW_AT_type      (0x0000003d "void ()")
98 ; SPLIT:      0x0000003d:   DW_TAG_subroutine_type
99 ; SPLIT-NEXT:                 DW_AT_prototyped        (true)
101 ; SPLIT:      0x0000003e:   DW_TAG_subprogram
102 ; SPLIT-NEXT:                 DW_AT_low_pc    (indexed (00000002) address = <unresolved>)
103 ; SPLIT-NEXT:                 DW_AT_high_pc   (0x00000002)
104 ; SPLIT-NEXT:                 DW_AT_frame_base        (DW_OP_WASM_location 0x3 0x0, DW_OP_stack_value)
105 ; SPLIT-NEXT:                 DW_AT_name      ("f2")
106 ; SPLIT-NEXT:                 DW_AT_decl_file (0x01)
107 ; SPLIT-NEXT:                 DW_AT_decl_line (2)
108 ; SPLIT-NEXT:                 DW_AT_prototyped        (true)
109 ; SPLIT-NEXT:                 DW_AT_external  (true)
111 ; SPLIT:      0x0000004f:   NULL
114 target triple = "wasm32-unknown-unknown"
116 source_filename = "test.c"
118 @myextern = external global i32, align 4
119 @foo = hidden global ptr @myextern, align 4, !dbg !0
120 @ptr2 = hidden global ptr @f2, align 4, !dbg !6
122 ; Function Attrs: noinline nounwind optnone
123 define hidden void @f2() #0 !dbg !17 {
124 entry:
125   ret void, !dbg !18
128 attributes #0 = { noinline nounwind optnone "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="none" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="generic" "unsafe-fp-math"="false" "use-soft-float"="false" }
130 !llvm.dbg.cu = !{!2}
131 !llvm.module.flags = !{!13, !14, !15}
132 !llvm.ident = !{!16}
134 !0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
135 !1 = distinct !DIGlobalVariable(name: "foo", scope: !2, file: !3, line: 4, type: !11, isLocal: false, isDefinition: true)
136 !2 = distinct !DICompileUnit(language: DW_LANG_C99, file: !3, producer: "clang version 6.0.0 (trunk 315924) (llvm/trunk 315960)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, globals: !5)
137 !3 = !DIFile(filename: "test.c", directory: "/usr/local/google/home/sbc/dev/wasm/simple")
138 !4 = !{}
139 !5 = !{!0, !6}
140 !6 = !DIGlobalVariableExpression(var: !7, expr: !DIExpression())
141 !7 = distinct !DIGlobalVariable(name: "ptr2", scope: !2, file: !3, line: 5, type: !8, isLocal: false, isDefinition: true)
142 !8 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !9, size: 32)
143 !9 = !DISubroutineType(types: !10)
144 !10 = !{null}
145 !11 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !12, size: 32)
146 !12 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
147 !13 = !{i32 2, !"Dwarf Version", i32 4}
148 !14 = !{i32 2, !"Debug Info Version", i32 3}
149 !15 = !{i32 1, !"wchar_size", i32 4}
150 !16 = !{!"clang version 6.0.0 (trunk 315924) (llvm/trunk 315960)"}
151 !17 = distinct !DISubprogram(name: "f2", scope: !3, file: !3, line: 2, type: !9, isLocal: false, isDefinition: true, scopeLine: 2, flags: DIFlagPrototyped, isOptimized: false, unit: !2, retainedNodes: !4)
152 !18 = !DILocation(line: 2, column: 16, scope: !17)