xref: /llvm-project/llvm/test/DebugInfo/X86/split-dwarf-v5-ranges.ll (revision 391f323690b9ef84d13a09ff07fb805008401fee)
1; RUN: llc -split-dwarf-file=foo.dwo -mtriple=x86_64-unknown-linux-gnu -filetype=obj %s -o %t32
2; RUN: llvm-dwarfdump -v -debug-info -debug-rnglists %t32 | \
3; RUN:   FileCheck %s --check-prefixes=CHECK,DWARF32
4
5; RUN: llc -dwarf64 -split-dwarf-file=foo.dwo -mtriple=x86_64-unknown-linux-gnu -filetype=obj %s -o %t64
6; RUN: llvm-dwarfdump -v -debug-info -debug-rnglists %t64 | \
7; RUN:   FileCheck %s --check-prefixes=CHECK,DWARF64
8
9; CHECK:   .debug_info contents:
10; CHECK:   .debug_info.dwo contents:
11; CHECK:   DW_AT_ranges [DW_FORM_rnglistx] (indexed (0x0) rangelist = 0x[[#%.8x,RNG_OFF:]]
12; CHECK:      [0x0000000000000001, 0x000000000000000c) ".text"
13; CHECK:      [0x000000000000000e, 0x0000000000000013) ".text")
14
15; CHECK:   .debug_rnglists.dwo contents:
16; DWARF32: 0x00000000: range list header: length = 0x00000015, format = DWARF32, version = 0x0005, addr_size = 0x08, seg_size = 0x00, offset_entry_count = 0x00000001
17; DWARF64: 0x00000000: range list header: length = 0x0000000000000019, format = DWARF64, version = 0x0005, addr_size = 0x08, seg_size = 0x00, offset_entry_count = 0x00000001
18; CHECK:   offsets: [
19; DWARF32: 0x00000004 => 0x[[#RNG_OFF]]
20; DWARF64: 0x0000000000000008 => 0x[[#RNG_OFF]]
21; CHECK:   ]
22; CHECK:   ranges:
23; CHECK:   0x[[#RNG_OFF]]:   [DW_RLE_base_addressx]:  0x0000000000000000
24; CHECK:   0x[[#RNG_OFF+2]]: [DW_RLE_offset_pair  ]:  0x0000000000000001, 0x000000000000000c => [0x0000000000000001, 0x000000000000000c)
25; CHECK:   0x[[#RNG_OFF+5]]: [DW_RLE_offset_pair  ]:  0x000000000000000e, 0x0000000000000013 => [0x000000000000000e, 0x0000000000000013)
26; CHECK:   0x[[#RNG_OFF+8]]: [DW_RLE_end_of_list  ]
27
28; Function Attrs: noinline optnone uwtable
29define dso_local void @_Z2f3v() !dbg !7 {
30entry:
31  %x = alloca i32, align 4
32  call void @llvm.dbg.declare(metadata ptr %x, metadata !10, metadata !DIExpression()), !dbg !13
33  %call = call i32 @_Z2f2v(), !dbg !14
34  store i32 %call, ptr %x, align 4, !dbg !13
35  %0 = load i32, ptr %x, align 4, !dbg !13
36  %tobool = icmp ne i32 %0, 0, !dbg !13
37  br i1 %tobool, label %if.then, label %if.end, !dbg !15
38
39if.then:                                          ; preds = %entry
40  call void @_Z2f1v(), !dbg !16
41  br label %if.end, !dbg !18
42
43if.end:                                           ; preds = %if.then, %entry
44  ret void, !dbg !19
45}
46
47; Function Attrs: nounwind readnone speculatable
48declare void @llvm.dbg.declare(metadata, metadata, metadata)
49
50declare dso_local i32 @_Z2f2v()
51
52declare dso_local void @_Z2f1v()
53
54; Function Attrs: noinline nounwind optnone uwtable
55define dso_local void @_Z2f4v() #3 section "x" !dbg !20 {
56entry:
57  ret void, !dbg !21
58}
59
60!llvm.dbg.cu = !{!0}
61!llvm.module.flags = !{!3, !4, !5}
62!llvm.ident = !{!6}
63
64!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 8.0.0 (trunk 344806) (llvm/trunk 344835)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, nameTableKind: GNU)
65!1 = !DIFile(filename: "ranges.cpp", directory: "/usr/local/google/home/blaikie/dev/scratch", checksumkind: CSK_MD5, checksum: "a1e825b91fba21d696f05eb06d440aa3")
66!2 = !{}
67!3 = !{i32 2, !"Dwarf Version", i32 5}
68!4 = !{i32 2, !"Debug Info Version", i32 3}
69!5 = !{i32 1, !"wchar_size", i32 4}
70!6 = !{!"clang version 8.0.0 (trunk 344806) (llvm/trunk 344835)"}
71!7 = distinct !DISubprogram(name: "f3", linkageName: "_Z2f3v", scope: !1, file: !1, line: 3, type: !8, isLocal: false, isDefinition: true, scopeLine: 3, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)
72!8 = !DISubroutineType(types: !9)
73!9 = !{null}
74!10 = !DILocalVariable(name: "x", scope: !11, file: !1, line: 4, type: !12)
75!11 = distinct !DILexicalBlock(scope: !7, file: !1, line: 4, column: 11)
76!12 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
77!13 = !DILocation(line: 4, column: 11, scope: !11)
78!14 = !DILocation(line: 4, column: 15, scope: !11)
79!15 = !DILocation(line: 4, column: 11, scope: !7)
80!16 = !DILocation(line: 5, column: 5, scope: !17)
81!17 = distinct !DILexicalBlock(scope: !11, file: !1, line: 4, column: 21)
82!18 = !DILocation(line: 6, column: 3, scope: !17)
83!19 = !DILocation(line: 7, column: 1, scope: !7)
84!20 = distinct !DISubprogram(name: "f4", linkageName: "_Z2f4v", scope: !1, file: !1, line: 8, type: !8, isLocal: false, isDefinition: true, scopeLine: 8, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)
85!21 = !DILocation(line: 8, column: 42, scope: !20)
86